web_to_print_store_incl_theme - Version 2.3.0.0

Version Notes

* Synchronise with Magento 1.9.0.2
* Remove support for Magento releases older than 1.6
* Improvements in 2-step theme
* Other small bug fixes and improvements

NOTE: this release doesn't support new RWD theme out of the box

Download this release

Release Info

Developer Anatoly A. Kazantsev
Extension web_to_print_store_incl_theme
Version 2.3.0.0
Comparing to
See all releases


Code changes from version 2.2.0.0 to 2.3.0.0

Files changed (71) hide show
  1. app/code/community/ZetaPrints/WebToPrint/Block/Html/Footer.php +1 -1
  2. app/code/community/ZetaPrints/WebToPrint/Helper/2step.php +68 -0
  3. app/code/community/ZetaPrints/WebToPrint/Helper/PersonalizationForm.php +45 -50
  4. app/code/community/ZetaPrints/WebToPrint/Model/Events/Observer.php +46 -10
  5. app/code/community/ZetaPrints/WebToPrint/Model/Profile/History.php +0 -18
  6. app/code/community/ZetaPrints/WebToPrint/etc/config.xml +22 -6
  7. app/design/frontend/base/default/layout/catalog/web-to-print-product.xml +3 -2
  8. app/design/frontend/default/zp2steptheme/etc/theme.xml +5 -0
  9. app/design/frontend/default/zp2steptheme/layout/local.xml +10 -0
  10. app/design/frontend/default/zp2steptheme/template/catalog/product/view.phtml +35 -24
  11. app/design/frontend/default/zp2steptheme/template/catalog/product/view/addto.phtml +2 -2
  12. app/design/frontend/default/zp2steptheme/template/catalog/product/view/addtocart.phtml +22 -14
  13. app/design/frontend/default/zp2steptheme/template/catalog/product/view/media.phtml +22 -13
  14. app/design/frontend/default/zptheme/etc/theme.xml +5 -0
  15. app/design/frontend/default/zptheme/template/catalog/product/view.phtml +10 -9
  16. app/design/frontend/default/zptheme/template/catalog/product/view/addto.phtml +1 -1
  17. app/design/frontend/default/zptheme/template/catalog/product/view/addtocart.phtml +2 -8
  18. app/design/frontend/default/zptheme/template/catalog/product/view/media.phtml +5 -5
  19. app/design/frontend/default/zptheme/template/checkout/cart/item/default.phtml +5 -5
  20. app/design/frontend/default/zptheme/template/sales/order/items.phtml +5 -6
  21. app/design/frontend/default/zptheme/template/sales/order/items/renderer/default.phtml +3 -3
  22. app/design/frontend/default/zptheme/template/wishlist/item/column/image.phtml +3 -3
  23. js/colorpicker/colorpicker.css +0 -187
  24. js/colorpicker/colorpicker.js +0 -554
  25. js/colorpicker/images/blank.gif +0 -0
  26. js/colorpicker/images/colorpicker_background.png +0 -0
  27. js/colorpicker/images/colorpicker_hex.png +0 -0
  28. js/colorpicker/images/colorpicker_hsb_b.png +0 -0
  29. js/colorpicker/images/colorpicker_hsb_h.png +0 -0
  30. js/colorpicker/images/colorpicker_hsb_s.png +0 -0
  31. js/colorpicker/images/colorpicker_indic.gif +0 -0
  32. js/colorpicker/images/colorpicker_overlay.png +0 -0
  33. js/colorpicker/images/colorpicker_rgb_b.png +0 -0
  34. js/colorpicker/images/colorpicker_rgb_g.png +0 -0
  35. js/colorpicker/images/colorpicker_rgb_r.png +0 -0
  36. js/colorpicker/images/colorpicker_select.gif +0 -0
  37. js/colorpicker/images/colorpicker_submit.png +0 -0
  38. js/colorpicker/images/custom_background.png +0 -0
  39. js/colorpicker/images/custom_hex.png +0 -0
  40. js/colorpicker/images/custom_hsb_b.png +0 -0
  41. js/colorpicker/images/custom_hsb_h.png +0 -0
  42. js/colorpicker/images/custom_hsb_s.png +0 -0
  43. js/colorpicker/images/custom_indic.gif +0 -0
  44. js/colorpicker/images/custom_rgb_b.png +0 -0
  45. js/colorpicker/images/custom_rgb_g.png +0 -0
  46. js/colorpicker/images/custom_rgb_r.png +0 -0
  47. js/colorpicker/images/custom_submit.png +0 -0
  48. js/colorpicker/images/select.png +0 -0
  49. js/colorpicker/images/select2.png +0 -0
  50. js/colorpicker/images/slider.png +0 -0
  51. js/jquery/jquery-ui-custom-min.js +4 -0
  52. js/zetaprints/colorpicker/colorpicker.css +227 -0
  53. js/zetaprints/colorpicker/colorpicker.js +2752 -0
  54. js/zetaprints/colorpicker/images/128/bar-alpha.png +0 -0
  55. js/zetaprints/colorpicker/images/128/bar.png +0 -0
  56. js/zetaprints/colorpicker/images/128/map.png +0 -0
  57. js/zetaprints/colorpicker/images/bar-alpha.png +0 -0
  58. js/zetaprints/colorpicker/images/bar-opacity.png +0 -0
  59. js/zetaprints/colorpicker/images/bar-pointer.png +0 -0
  60. js/zetaprints/colorpicker/images/bar.png +0 -0
  61. js/zetaprints/colorpicker/images/map-opacity.png +0 -0
  62. js/zetaprints/colorpicker/images/map-pointer.png +0 -0
  63. js/zetaprints/colorpicker/images/map.png +0 -0
  64. js/zetaprints/colorpicker/images/preview-opacity.png +0 -0
  65. js/zetaprints/colorpicker/images/ui-colorpicker.png +0 -0
  66. js/zetaprints/colorpicker/switcher.js +66 -0
  67. js/zetaprints/zp-text-field-editor.js +32 -29
  68. package.xml +11 -15
  69. skin/frontend/base/default/css/zp-style.css +132 -0
  70. skin/frontend/base/default/js/zp-in-preview-edit.js +13 -1
  71. skin/frontend/base/default/js/zp-personalization-form.js +65 -32
app/code/community/ZetaPrints/WebToPrint/Block/Html/Footer.php CHANGED
@@ -3,7 +3,7 @@
3
  class ZetaPrints_WebToPrint_Block_Html_Footer extends Mage_Page_Block_Html_Footer {
4
  public function getCopyright() {
5
  return parent::getCopyright()
6
- . '<br /><span id="zetaprints-extension-version"><a href="http://www.zetaprints.com/">Web-to-print and image generation</a>, v. 2.2.0.0</span>';
7
  }
8
  }
9
 
3
  class ZetaPrints_WebToPrint_Block_Html_Footer extends Mage_Page_Block_Html_Footer {
4
  public function getCopyright() {
5
  return parent::getCopyright()
6
+ . '<br /><span id="zetaprints-extension-version"><a href="http://www.zetaprints.com/">Web-to-print and image generation</a>, v. 2.3.0.0</span>';
7
  }
8
  }
9
 
app/code/community/ZetaPrints/WebToPrint/Helper/2step.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ZetaPrints_WebToPrint_Helper_2step
4
+ extends ZetaPrints_WebToPrint_Helper_Data
5
+ {
6
+ public function isPersonalisationStep () {
7
+ return Mage::registry('webtoprint_is_personalisation_step');
8
+ }
9
+
10
+ public function getNextStepRoute ($product) {
11
+ $data = array(
12
+ 'route' => 'catalog/product/view',
13
+ 'params' => array(
14
+ 'id' => $product->getId(),
15
+ 's' => $product->getUrlKey(),
16
+ '_use_rewrite' => true,
17
+
18
+ //Add personalization parameter to URL
19
+ '_query' => array('personalization' => '1')
20
+ )
21
+ );
22
+
23
+ if ($product->getCategoryId() && !$product->getDoNotUseCategoryId())
24
+ $data['params']['category'] = $product->getCategoryId();
25
+
26
+ $request = Mage::app()->getRequest();
27
+
28
+ //Check if the product page was requested with reorder parameter
29
+ //then proxy the parameter to personalization step
30
+ if ($request->has('reorder'))
31
+ $data['_query']['reorder'] = $request->getParam('reorder');
32
+
33
+ //Check if the product page was requested with for-item parameter
34
+ //then proxy the parameter to personalization step and ignore last
35
+ //visited page (need it to distinguish cross-sell product and already
36
+ //personalized product)
37
+ if ($request->has('for-item'))
38
+ $data['_query']['for-item'] = $request->getParam('for-item');
39
+ else {
40
+ //Check that the product page was opened from cart page (need for
41
+ //automatic first preview update for cross-sell product)
42
+
43
+ $pos = strpos(
44
+ Mage::getSingleton('core/session')->getData('last_url'),
45
+ 'checkout/cart'
46
+ );
47
+
48
+ if ($pos !== false)
49
+ //Send update-first-preview query parameter to personalization step
50
+ $data['_query']['update-first-preview'] = 1;
51
+ }
52
+
53
+ return $data;
54
+ }
55
+
56
+ public function getImageType ($default = 'image') {
57
+ return $this->isPersonalisationStep()
58
+ ? $default
59
+ : 'small_image';
60
+ }
61
+
62
+ public function getImageLabel ($context, $default = null) {
63
+ if ($this->isPersonalisationStep())
64
+ return $default ? $default : $context->getImageLabel();
65
+
66
+ return $context->getImageLabel(null, 'small_image');
67
+ }
68
+ }
app/code/community/ZetaPrints/WebToPrint/Helper/PersonalizationForm.php CHANGED
@@ -105,45 +105,34 @@ class ZetaPrints_WebToPrint_Helper_PersonalizationForm
105
  }
106
  }
107
 
 
 
 
 
108
  public function is_personalization_step ($context) {
109
- return $context->getRequest()->getParam('personalization') == '1';
110
  }
111
 
 
 
 
 
112
  public function get_next_step_url ($context) {
113
- if (!$this->is_personalization_step($context)) {
114
- //Add personalization parameter to URL
115
- $params = array('personalization' => '1');
116
-
117
- //Check if the product page was requested with reorder parameter
118
- //then proxy the parameter to personalization step
119
- if ($this->_getRequest()->has('reorder'))
120
- $params['reorder'] = $this->_getRequest()->getParam('reorder');
121
-
122
- //Check if the product page was requested with for-item parameter
123
- //then proxy the parameter to personalization step and ignore last
124
- //visited page (need it to distinguish cross-sell product and already
125
- //personalized product)
126
- if ($this->_getRequest()->has('for-item'))
127
- $params['for-item'] = $this->_getRequest()->getParam('for-item');
128
- else
129
- //Check that the product page was opened from cart page (need for
130
- //automatic first preview update for cross-sell product)
131
- if (strpos(Mage::getSingleton('core/session')->getData('last_url'),
132
- 'checkout/cart') !== false)
133
- //Send update-first-preview query parameter to personalization step
134
- $params['update-first-preview'] = 1;
135
 
136
- //Print out url for the product
137
- echo $this->create_url_for_product($context->getProduct(), $params);
 
 
 
138
 
139
- return true;
140
- }
141
- else
142
- return false;
143
  }
144
 
145
  public function get_params_from_previous_step ($context) {
146
- if (!$this->is_personalization_step($context))
147
  return;
148
 
149
  foreach ($_POST as $key => $value) {
@@ -299,13 +288,31 @@ jQuery(document).ready(function($) {
299
  <?php
300
  }
301
 
 
 
 
 
 
302
  public function get_preview_image ($context) {
303
- if (!$context->getProduct()->getSmallImage())
 
 
304
  return false;
305
 
306
- $img = '<img src="' . $context->helper('catalog/image')->init($context->getProduct(), 'small_image')->resize(265) . '" alt="'.$context->htmlEscape($context->getProduct()->getSmallImageLabel()).'" />';
 
 
 
 
307
 
308
- echo $context->helper('catalog/output')->productAttribute($context->getProduct(), $img, 'small_image');
 
 
 
 
 
 
 
309
 
310
  return true;
311
  }
@@ -402,7 +409,8 @@ jQuery(document).ready(function($) {
402
  if (!$this->get_template_id($context->getProduct()))
403
  return false;
404
 
405
- if ($check_for_personalization && !$this->is_personalization_step($context))
 
406
  return false;
407
 
408
  $images = $context->getProduct()->getMediaGalleryImages();
@@ -1076,14 +1084,6 @@ jQuery(document).ready(function($) {
1076
  $name, '" class="zp-hidden" />';
1077
  }
1078
 
1079
- $session = Mage::getSingleton('core/session');
1080
-
1081
- if ($session->hasData('zetaprints-previews')) {
1082
- $userInput = unserialize($session->getData('zetaprints-user-input'));
1083
-
1084
- $session->unsetData('zetaprints-previews');
1085
- }
1086
-
1087
  $request = $this->_getRequest();
1088
 
1089
  //Check if the product page is requested with 'for-item' parameter
@@ -1096,7 +1096,7 @@ jQuery(document).ready(function($) {
1096
  //Check if the product page is requested with 'reorder' parameter
1097
  $hasReorder = strlen($request->getParam('reorder')) == 36;
1098
 
1099
- $lastUrl = $session->getData('last_url');
1100
 
1101
  //Check if the product page is opened from the shopping cart
1102
  //to update first preview image for cross-sell products)
@@ -1126,7 +1126,8 @@ jQuery(document).ready(function($) {
1126
 
1127
  $data = json_encode(array(
1128
  'template_details' => $details,
1129
- 'is_personalization_step' => $this->is_personalization_step($context),
 
1130
  'update_first_preview_on_load' => $updateFirstPreview,
1131
  'preserve_fields' => $preserveFields,
1132
  'has_shapes' => $hasShapes,
@@ -1153,12 +1154,6 @@ var userImageThumbSelected = null; //user selected image to edit
1153
  // Global vars end
1154
 
1155
  jQuery(document).ready(function($) {
1156
- <?php
1157
- if (isset($userInput) && is_array($userInput))
1158
- foreach ($userInput as $key => $value)
1159
- echo '$(\'[name="' . $key . '"]\').val(\'' . $value . '\');\n';
1160
- ?>
1161
-
1162
  zp = <?php echo $data ?>;
1163
 
1164
  edit_button_text = "<?php echo $this->__('Edit');?>";
105
  }
106
  }
107
 
108
+ /**
109
+ * @deprecated after 2.3.0.0
110
+ * @see ZetaPrints_WebToPrint_Helper_2step::isPersonalisationStep()
111
+ */
112
  public function is_personalization_step ($context) {
113
+ return Mage::registry('webtoprint_is_personalisation_step');
114
  }
115
 
116
+ /**
117
+ * @deprecated after 2.3.0.0
118
+ * @see ZetaPrints_WebToPrint_Model_Events_Observer::setUrlForNextStep()
119
+ */
120
  public function get_next_step_url ($context) {
121
+ $product = $context->getProduct();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
+ if (!Mage::registry('webtoprint_is_personalisation_step'))
124
+ $context->setData(
125
+ 'submit_route_data',
126
+ Mage::helper('webtoprint/2step')->getNextStepRoute($product)
127
+ );
128
 
129
+ echo $context->getSubmitUrl($product);
130
+
131
+ return true;
 
132
  }
133
 
134
  public function get_params_from_previous_step ($context) {
135
+ if (!Mage::registry('webtoprint_is_personalisation_step'))
136
  return;
137
 
138
  foreach ($_POST as $key => $value) {
288
  <?php
289
  }
290
 
291
+ /**
292
+ * @deprecated after 2.3.0.0
293
+ * @see ZetaPrints_WebToPrint_Model_Events_Observer::getImageType()
294
+ * @see ZetaPrints_WebToPrint_Model_Events_Observer::getImageLabel()
295
+ */
296
  public function get_preview_image ($context) {
297
+ $product = $context->getProduct();
298
+
299
+ if (!$product->getSmallImage())
300
  return false;
301
 
302
+ $url = $context->helper('catalog/image')
303
+ ->init($product, 'small_image')
304
+ ->resize(265);
305
+
306
+ $label = $this->escapeHtml($context->getImageLabel(null, 'small_image'));
307
 
308
+ echo $context->helper('catalog/output')->productAttribute(
309
+ $product,
310
+ '<img id="image" src="' . $url
311
+ . '" alt="' . $label
312
+ . '" title="' . $label
313
+ . '" />',
314
+ 'small_image'
315
+ );
316
 
317
  return true;
318
  }
409
  if (!$this->get_template_id($context->getProduct()))
410
  return false;
411
 
412
+ if ($check_for_personalization
413
+ && !Mage::registry('webtoprint_is_personalisation_step'))
414
  return false;
415
 
416
  $images = $context->getProduct()->getMediaGalleryImages();
1084
  $name, '" class="zp-hidden" />';
1085
  }
1086
 
 
 
 
 
 
 
 
 
1087
  $request = $this->_getRequest();
1088
 
1089
  //Check if the product page is requested with 'for-item' parameter
1096
  //Check if the product page is requested with 'reorder' parameter
1097
  $hasReorder = strlen($request->getParam('reorder')) == 36;
1098
 
1099
+ $lastUrl = Mage::getSingleton('core/session')->getData('last_url');
1100
 
1101
  //Check if the product page is opened from the shopping cart
1102
  //to update first preview image for cross-sell products)
1126
 
1127
  $data = json_encode(array(
1128
  'template_details' => $details,
1129
+ 'is_personalization_step'
1130
+ => Mage::registry('webtoprint_is_personalisation_step'),
1131
  'update_first_preview_on_load' => $updateFirstPreview,
1132
  'preserve_fields' => $preserveFields,
1133
  'has_shapes' => $hasShapes,
1154
  // Global vars end
1155
 
1156
  jQuery(document).ready(function($) {
 
 
 
 
 
 
1157
  zp = <?php echo $data ?>;
1158
 
1159
  edit_button_text = "<?php echo $this->__('Edit');?>";
app/code/community/ZetaPrints/WebToPrint/Model/Events/Observer.php CHANGED
@@ -120,16 +120,6 @@ class ZetaPrints_WebToPrint_Model_Events_Observer implements ZetaPrints_Api {
120
 
121
  Mage::getSingleton('core/session')
122
  ->setData('zetaprints-previews', $previews);
123
-
124
- $user_input = array();
125
- foreach ($request->getParams() as $key => $value)
126
- if (strpos($key, 'zetaprints-') !== false) {
127
- $_key = substr($key, 11);
128
- $_key = substr($_key, 0, 1).str_replace('_', ' ', substr($_key, 1));
129
- $user_input['zetaprints-' . $_key] = str_replace("\r\n", "\\r\\n", $value);
130
- }
131
-
132
- Mage::getSingleton('core/session')->setData('zetaprints-user-input', serialize($user_input));
133
  }
134
 
135
  public function set_required_options ($observer) {
@@ -480,6 +470,52 @@ class ZetaPrints_WebToPrint_Model_Events_Observer implements ZetaPrints_Api {
480
  array('_current' => true) ),
481
  'class' => 'ajax' ) );
482
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
  }
484
 
485
  ?>
120
 
121
  Mage::getSingleton('core/session')
122
  ->setData('zetaprints-previews', $previews);
 
 
 
 
 
 
 
 
 
 
123
  }
124
 
125
  public function set_required_options ($observer) {
470
  array('_current' => true) ),
471
  'class' => 'ajax' ) );
472
  }
473
+
474
+ public function registerFormStep ($observer) {
475
+ Mage::unregister('webtoprint_is_personalisation_step');
476
+ Mage::register(
477
+ 'webtoprint_is_personalisation_step',
478
+ Mage::app()->getRequest()->getParam('personalization') == '1',
479
+ true
480
+ );
481
+
482
+ return $this;
483
+ }
484
+
485
+ public function setUrlForNextStep ($observer) {
486
+ $block = $observer->getBlock();
487
+
488
+ if (!($block instanceof Mage_Catalog_Block_Product_View))
489
+ return $this;
490
+
491
+ if (Mage::registry('webtoprint_is_personalisation_step'))
492
+ return $this;
493
+
494
+ $is2step = (bool) $block
495
+ ->getLayout()
496
+ ->getBlock('root')
497
+ ->getData('webtoprint_2step');
498
+
499
+ if (!$is2step)
500
+ return $this;
501
+
502
+ if ($route = Mage::registry('webtoprint_next_step_route')) {
503
+ $block->setData('submit_route_data', $route);
504
+
505
+ return $this;
506
+ }
507
+
508
+ $route = Mage::helper('webtoprint/2step')->getNextStepRoute(
509
+ $block->getProduct()
510
+ );
511
+
512
+ Mage::unregister('webtoprint_next_step_route');
513
+
514
+ Mage::register('webtoprint_next_step_route', $route, true);
515
+ $block->setData('submit_route_data', $route);
516
+
517
+ return $this;
518
+ }
519
  }
520
 
521
  ?>
app/code/community/ZetaPrints/WebToPrint/Model/Profile/History.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
-
3
- class ZetaPrints_WebToPrint_Model_Profile_History
4
- extends Mage_Dataflow_Model_Profile_History {
5
-
6
- protected function _beforeSave () {
7
- if (!$this->getUserId() && !Mage::getSingleton('admin/session')->hasUser()) {
8
- $users = Mage::getModel('admin/user')->getCollection();
9
-
10
- if ($users->count() > 0)
11
- $this->setUserId($users->getFirstItem()->getId());
12
- }
13
-
14
- return parent::_beforeSave();
15
- }
16
- }
17
-
18
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ZetaPrints/WebToPrint/etc/config.xml CHANGED
@@ -30,12 +30,6 @@
30
  </entities>
31
  </webtoprint_resource>
32
 
33
- <dataflow>
34
- <rewrite>
35
- <profile_history>ZetaPrints_WebToPrint_Model_Profile_History</profile_history>
36
- </rewrite>
37
- </dataflow>
38
-
39
  <sales>
40
  <rewrite>
41
  <quote_item>ZetaPrints_WebToPrint_Model_Quote_Item</quote_item>
@@ -285,6 +279,28 @@
285
  </wishlist-web-to-print>
286
  </updates>
287
  </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  </frontend>
289
 
290
  <admin>
30
  </entities>
31
  </webtoprint_resource>
32
 
 
 
 
 
 
 
33
  <sales>
34
  <rewrite>
35
  <quote_item>ZetaPrints_WebToPrint_Model_Quote_Item</quote_item>
279
  </wishlist-web-to-print>
280
  </updates>
281
  </layout>
282
+
283
+ <events>
284
+ <catalog_controller_product_view>
285
+ <observers>
286
+ <webtoprint_register_form_step>
287
+ <type>singleton</type>
288
+ <class>ZetaPrints_WebToPrint_Model_Events_Observer</class>
289
+ <method>registerFormStep</method>
290
+ </webtoprint_register_form_step>
291
+ </observers>
292
+ </catalog_controller_product_view>
293
+
294
+ <core_block_abstract_to_html_before>
295
+ <observers>
296
+ <webtoprint_set_url_for_next_step>
297
+ <type>singleton</type>
298
+ <class>ZetaPrints_WebToPrint_Model_Events_Observer</class>
299
+ <method>setUrlForNextStep</method>
300
+ </webtoprint_set_url_for_next_step>
301
+ </observers>
302
+ </core_block_abstract_to_html_before>
303
+ </events>
304
  </frontend>
305
 
306
  <admin>
app/design/frontend/base/default/layout/catalog/web-to-print-product.xml CHANGED
@@ -3,7 +3,6 @@
3
  <reference name="head">
4
  <action method="addJs"><script>jquery/jquery-min.js</script></action>
5
  <action method="addJs"><script>jquery/jquery-ui-custom-min.js</script></action>
6
- <action method="addJs"><script>colorpicker/colorpicker.js</script></action>
7
  <action method="addJs"><script>jquery/jquery-qtip-min.js</script></action>
8
  <action method="addJs"><script>fancybox/jquery-fancybox.js</script></action>
9
  <action method="addJs"><script>fancybox/fancybox-resizing.js</script></action>
@@ -11,6 +10,8 @@
11
  <action method="addJs"><script>fancybox/fancybox-select-image.js</script></action>
12
  <action method="addJs"><script>fancybox/fancybox-save-image.js</script></action>
13
  <action method="addJs"><script>lib/ajaxupload.js</script></action>
 
 
14
  <action method="addJs"><script>zetaprints/zp-text-field-resizer.js</script></action>
15
  <action method="addJs"><script>zetaprints/zp-text-field-editor.js</script></action>
16
  <action method="addJs"><script>zetaprints/zp-combobox-field.js</script></action>
@@ -20,12 +21,12 @@
20
  <action method="addItem"><type>skin_js</type><name>js/zp-image-edit.js</name></action>
21
  <action method="addItem"><type>skin_js</type><name>js/zp-personalization-form.js</name></action>
22
 
23
- <action method="addItem"><type>js_css</type><name>colorpicker/colorpicker.css</name></action>
24
  <action method="addItem"><type>js_css</type><name>fancybox/jquery-fancybox.css</name></action>
25
  <action method="addItem"><type>js_css</type><name>fancybox/fancybox-resizing.css</name></action>
26
  <action method="addItem"><type>js_css</type><name>fancybox/fancybox-update-preview.css</name></action>
27
  <action method="addItem"><type>js_css</type><name>fancybox/fancybox-select-image.css</name></action>
28
  <action method="addItem"><type>js_css</type><name>fancybox/fancybox-save-image.css</name></action>
 
29
  <action method="addItem"><type>js_css</type><name>zetaprints/zp-text-field-editor.css</name></action>
30
  <action method="addItem"><type>js_css</type><name>zetaprints/zp-combobox-field.css</name></action>
31
  <action method="addItem"><type>js_css</type><name>zetaprints/zp-dataset.css</name></action>
3
  <reference name="head">
4
  <action method="addJs"><script>jquery/jquery-min.js</script></action>
5
  <action method="addJs"><script>jquery/jquery-ui-custom-min.js</script></action>
 
6
  <action method="addJs"><script>jquery/jquery-qtip-min.js</script></action>
7
  <action method="addJs"><script>fancybox/jquery-fancybox.js</script></action>
8
  <action method="addJs"><script>fancybox/fancybox-resizing.js</script></action>
10
  <action method="addJs"><script>fancybox/fancybox-select-image.js</script></action>
11
  <action method="addJs"><script>fancybox/fancybox-save-image.js</script></action>
12
  <action method="addJs"><script>lib/ajaxupload.js</script></action>
13
+ <action method="addJs"><script>zetaprints/colorpicker/colorpicker.js</script></action>
14
+ <action method="addJs"><script>zetaprints/colorpicker/switcher.js</script></action>
15
  <action method="addJs"><script>zetaprints/zp-text-field-resizer.js</script></action>
16
  <action method="addJs"><script>zetaprints/zp-text-field-editor.js</script></action>
17
  <action method="addJs"><script>zetaprints/zp-combobox-field.js</script></action>
21
  <action method="addItem"><type>skin_js</type><name>js/zp-image-edit.js</name></action>
22
  <action method="addItem"><type>skin_js</type><name>js/zp-personalization-form.js</name></action>
23
 
 
24
  <action method="addItem"><type>js_css</type><name>fancybox/jquery-fancybox.css</name></action>
25
  <action method="addItem"><type>js_css</type><name>fancybox/fancybox-resizing.css</name></action>
26
  <action method="addItem"><type>js_css</type><name>fancybox/fancybox-update-preview.css</name></action>
27
  <action method="addItem"><type>js_css</type><name>fancybox/fancybox-select-image.css</name></action>
28
  <action method="addItem"><type>js_css</type><name>fancybox/fancybox-save-image.css</name></action>
29
+ <action method="addItem"><type>js_css</type><name>zetaprints/colorpicker/colorpicker.css</name></action>
30
  <action method="addItem"><type>js_css</type><name>zetaprints/zp-text-field-editor.css</name></action>
31
  <action method="addItem"><type>js_css</type><name>zetaprints/zp-combobox-field.css</name></action>
32
  <action method="addItem"><type>js_css</type><name>zetaprints/zp-dataset.css</name></action>
app/design/frontend/default/zp2steptheme/etc/theme.xml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <theme>
4
+ <parent>default/zptheme</parent>
5
+ </theme>
app/design/frontend/default/zp2steptheme/layout/local.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="0.1.0">
2
+ <default>
3
+ <reference name="root">
4
+ <action method="setData">
5
+ <key>webtoprint_2step</key>
6
+ <value>true</value>
7
+ </action>
8
+ </reference>
9
+ </default>
10
+ </layout>
app/design/frontend/default/zp2steptheme/template/catalog/product/view.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
@@ -48,18 +48,14 @@
48
  : $this->getAddToCartUrl($_product);
49
  ?>
50
 
51
- <!-- /****** ZP-CODE:1 Checking for current step and outputting link for a next step ******/ -->
52
 
53
- <form action="<?php if (!$this->helper('webtoprint/personalization-form')->get_next_step_url($this)) echo $actionUrl; ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
 
54
 
55
- <!-- /****** ZP-CODE:1 End ******/ -->
56
 
57
- <!-- /****** ZP-CODE:2 Check if this step is not personalization
58
- then show standard magento product page... ******/ -->
59
-
60
- <?php if(!$this->helper('webtoprint/personalization-form')->is_personalization_step($this)): ?>
61
-
62
- <!-- /****** ZP-CODE:2 End ******/ -->
63
 
64
  <?php echo $this->getBlockHtml('formkey') ?>
65
  <div class="no-display">
@@ -122,27 +118,29 @@
122
  <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
123
  <?php endif;?>
124
 
125
- <!-- /****** ZP-CODE:3 ... otherwise show web-to-print personalization form ******/ -->
126
 
127
  <?php else: ?>
128
 
129
- <!-- /****** ZP-CODE:3 End ******/ -->
130
 
131
- <!-- /****** ZP-CODE:4 Printing image tabs for multipage products with web-to-print feature ******/ -->
 
132
 
133
  <?php $this->helper('webtoprint/personalization-form')->get_page_tabs($this); ?>
134
 
135
- <!-- /****** ZP-CODE:4 End ******/ -->
136
 
137
  <div class="no-display">
138
  <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
139
  <input type="hidden" name="related_product" id="related-products-field" value="" />
140
 
141
- <!-- /****** ZP-CODE:5 Printing list <input> tags for params from step 1 (options) ******/ -->
 
142
 
143
  <?php echo $this->helper('webtoprint/personalization-form')->get_params_from_previous_step($this); ?>
144
 
145
- <!-- /****** ZP-CODE:5 End ******/ -->
146
 
147
  </div>
148
 
@@ -155,37 +153,50 @@
155
  <?php echo $this->getChildHtml('addtocart') ?>
156
  </div>
157
 
158
- <!-- /****** ZP-CODE:6 Printing input fields, stock images choosers and color pickers for products
159
- with web-to-print feature ******/ -->
 
 
 
 
 
 
 
160
 
161
  <?php $this->helper('webtoprint/personalization-form')->get_text_fields($this); ?>
162
  <?php $this->helper('webtoprint/personalization-form')->get_image_fields($this); ?>
 
163
 
164
  <!-- /****** ZP-CODE:6 End ******/ -->
165
 
166
  </div>
167
 
 
 
 
168
  <div id="zetaprints-preview-image-container" class="product-img-box">
 
 
 
169
  <?php echo $this->getChildHtml('media') ?>
170
  </div>
171
 
172
- <!-- /****** ZP-CODE:7 Printing preview and next page buttond
173
- for products with web-to-print feature ******/ -->
174
 
175
- <?php $this->helper('webtoprint/personalization-form')->get_preview_button($this); ?>
176
- <?php $this->helper('webtoprint/personalization-form')->get_next_page_button($this); ?>
177
 
178
  <!-- /****** ZP-CODE:7 End ******/ -->
179
 
180
  <div class="clearer"></div>
181
 
182
- <!-- /****** ZP-CODE:8 Printing JavaScript for magento personalization form ******/ -->
183
 
184
  <?php $this->helper('webtoprint/personalization-form')->get_js($this); ?>
185
 
186
  <!-- /****** ZP-CODE:8 End ******/ -->
187
 
188
- <!-- /****** ZP-CODE:9 Close 'if' opened in ZP-CODE:2 ******/ -->
189
 
190
  <?php endif; ?>
191
 
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
48
  : $this->getAddToCartUrl($_product);
49
  ?>
50
 
51
+ <form action="<?php echo $actionUrl; ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
52
 
53
+ <!-- /****** ZP-CODE:1 Check if this step is not personalisation
54
+ then show standard M. product page... ******/ -->
55
 
56
+ <?php if(!$this->helper('webtoprint/2step')->isPersonalisationStep()): ?>
57
 
58
+ <!-- /****** ZP-CODE:1 End ******/ -->
 
 
 
 
 
59
 
60
  <?php echo $this->getBlockHtml('formkey') ?>
61
  <div class="no-display">
118
  <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
119
  <?php endif;?>
120
 
121
+ <!-- /****** ZP-CODE:2 ... otherwise show web-to-print personalisation form ******/ -->
122
 
123
  <?php else: ?>
124
 
125
+ <!-- /****** ZP-CODE:2 End ******/ -->
126
 
127
+ <!-- /****** ZP-CODE:3 Output image tabs for multipage products
128
+ with web-to-print feature ******/ -->
129
 
130
  <?php $this->helper('webtoprint/personalization-form')->get_page_tabs($this); ?>
131
 
132
+ <!-- /****** ZP-CODE:3 End ******/ -->
133
 
134
  <div class="no-display">
135
  <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
136
  <input type="hidden" name="related_product" id="related-products-field" value="" />
137
 
138
+ <!-- /****** ZP-CODE:4 Output list of <input> tags for params
139
+ from step 1 (options) ******/ -->
140
 
141
  <?php echo $this->helper('webtoprint/personalization-form')->get_params_from_previous_step($this); ?>
142
 
143
+ <!-- /****** ZP-CODE:4 End ******/ -->
144
 
145
  </div>
146
 
153
  <?php echo $this->getChildHtml('addtocart') ?>
154
  </div>
155
 
156
+ <!-- /****** ZP-CODE:5 Output button for showing data sets ******/ -->
157
+
158
+ <?php $this->helper('webtoprint/personalization-form')->getDataSetTable($this); ?>
159
+
160
+ <!-- /****** ZP-CODE:5 End ******/ -->
161
+
162
+ <!-- /****** ZP-CODE:6 Output input fields, images, stock images,
163
+ colour pickers and palettes for products
164
+ with web-to-print feature ******/ -->
165
 
166
  <?php $this->helper('webtoprint/personalization-form')->get_text_fields($this); ?>
167
  <?php $this->helper('webtoprint/personalization-form')->get_image_fields($this); ?>
168
+ <?php echo $this->getChildHtml('webtoprint_palettes'); ?>
169
 
170
  <!-- /****** ZP-CODE:6 End ******/ -->
171
 
172
  </div>
173
 
174
+ <!-- /****** ZP-CHANGE:1 Add ID attribute to the element.
175
+ Required by web-to-print JS code ******/ -->
176
+
177
  <div id="zetaprints-preview-image-container" class="product-img-box">
178
+
179
+ <!-- /****** ZP-CHANGE:1 End ******/ -->
180
+
181
  <?php echo $this->getChildHtml('media') ?>
182
  </div>
183
 
184
+ <!-- /****** ZP-CODE:7 Output web-to-print buttons for products
185
+ with web-to-print feature ******/ -->
186
 
187
+ <?php echo $this->getChildHtml('webtoprint_buttons'); ?>
 
188
 
189
  <!-- /****** ZP-CODE:7 End ******/ -->
190
 
191
  <div class="clearer"></div>
192
 
193
+ <!-- /****** ZP-CODE:8 Output JavaScript for personalisation form ******/ -->
194
 
195
  <?php $this->helper('webtoprint/personalization-form')->get_js($this); ?>
196
 
197
  <!-- /****** ZP-CODE:8 End ******/ -->
198
 
199
+ <!-- /****** ZP-CODE:9 Close 'if' opened in ZP-CODE:2 ******/ -->
200
 
201
  <?php endif; ?>
202
 
app/design/frontend/default/zp2steptheme/template/catalog/product/view/addto.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
@@ -30,7 +30,7 @@
30
 
31
  <ul class="add-to-links">
32
  <?php if ($this->helper('wishlist')->isAllow()) : ?>
33
- <li><a href="<?php echo $_wishlistSubmitUrl ?>" onclick="productAddToCartForm.submitLight(this, this.href); return false;" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
34
  <?php endif; ?>
35
  <?php
36
  $_compareUrl = $this->helper('catalog/product_compare')->getAddUrl($_product);
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
30
 
31
  <ul class="add-to-links">
32
  <?php if ($this->helper('wishlist')->isAllow()) : ?>
33
+ <li><a href="<?php echo $_wishlistSubmitUrl ?>" onclick="productAddToCartForm.submitLight(this, this.href); return false;" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
34
  <?php endif; ?>
35
  <?php
36
  $_compareUrl = $this->helper('catalog/product_compare')->getAddUrl($_product);
app/design/frontend/default/zp2steptheme/template/catalog/product/view/addtocart.phtml CHANGED
@@ -20,44 +20,52 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
-
28
  <?php $_product = $this->getProduct(); ?>
29
  <?php $buttonTitle = $this->__('Add to Cart'); ?>
30
  <?php if($_product->isSaleable()): ?>
31
 
32
- <!-- /****** ZP-CODE:1 Check if current step is step 1 (options)
33
- then show "Personalize" button... ******/ -->
34
 
35
- <?php if(!$this->helper('webtoprint/personalization-form')->is_personalization_step($this)): ?>
36
 
37
  <!-- /****** ZP-CODE:1 End ******/ -->
38
 
39
  <div class="add-to-cart">
40
- <?php if(!$_product->isGrouped()): ?>
41
- <label for="qty"><?php echo $this->__('Qty:') ?></label>
42
- <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
43
- <?php endif; ?>
44
- <button type="button" title="<?php echo $this->__('Personalize') ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $this->__('Personalize') ?></span></span></button>
45
  </div>
46
 
47
- <!-- /****** ZP-CODE:2 ... otherwise show "Add to cart" button ******/ -->
 
48
 
49
  <?php else: ?>
50
 
51
  <!-- /****** ZP-CODE:2 End ******/ -->
52
 
53
  <div class="add-to-cart">
54
- <button id="zetaprints-add-to-cart-button" type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
 
 
 
 
 
 
 
 
 
 
 
 
55
  </div>
56
 
57
- <!-- /****** ZP-CODE:3 Close 'if' opened in ZP-CODE:1 ******/ -->
58
 
59
  <?php endif; ?>
60
 
61
- <!-- /****** ZP-CODE:3 End ******/ -->
62
 
63
  <?php endif; ?>
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
 
27
  <?php $_product = $this->getProduct(); ?>
28
  <?php $buttonTitle = $this->__('Add to Cart'); ?>
29
  <?php if($_product->isSaleable()): ?>
30
 
31
+ <!-- /****** ZP-CODE:1 Show Add to cart button if current step is
32
+ personalisation (step 2)... ******/ -->
33
 
34
+ <?php if ($this->helper('webtoprint/2step')->isPersonalisationStep()): ?>
35
 
36
  <!-- /****** ZP-CODE:1 End ******/ -->
37
 
38
  <div class="add-to-cart">
39
+ <button type="button" title="<?php echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
 
 
 
 
40
  </div>
41
 
42
+ <!-- /****** ZP-CODE:2 ... otherwise show default HTML with Personalise
43
+ button ******/ -->
44
 
45
  <?php else: ?>
46
 
47
  <!-- /****** ZP-CODE:2 End ******/ -->
48
 
49
  <div class="add-to-cart">
50
+ <?php if(!$_product->isGrouped()): ?>
51
+ <label for="qty"><?php echo $this->__('Qty:') ?></label>
52
+ <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
53
+ <?php endif; ?>
54
+
55
+ <!-- /****** ZP-CODE:3 Change button title to "Personalise" ******/ -->
56
+
57
+ <?php $buttonTitle = $this->helper('webtoprint')->__('Personalise'); ?>
58
+
59
+ <!-- /****** ZP-CODE:3 End ******/ -->
60
+
61
+ <button type="button" title="<?php echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
62
+ <?php echo $this->getChildHtml('', true, true) ?>
63
  </div>
64
 
65
+ <!-- /****** ZP-CODE:4 Close 'if' opened in ZP-CODE:1 ******/ -->
66
 
67
  <?php endif; ?>
68
 
69
+ <!-- /****** ZP-CODE:4 End ******/ -->
70
 
71
  <?php endif; ?>
app/design/frontend/default/zp2steptheme/template/catalog/product/view/media.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
@@ -59,28 +59,37 @@
59
  <?php else: ?>
60
  <p class="product-image">
61
  <?php
62
- $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
63
 
64
- /****** ZP-CODE:1 Checking for personalization step and disabling image resizing for
65
- products with web-to-print feature ******/
66
-
67
- if (!$this->helper('webtoprint/personalization-form')->is_personalization_step($this))
68
- $this->helper('webtoprint/personalization-form')->get_preview_image($this);
69
- else
70
- echo $_helper->productAttribute($_product, $_img, 'image');
71
 
 
 
72
 
73
  /****** ZP-CODE:1 End ******/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  ?>
75
  </p>
76
  <?php endif; ?>
77
 
78
- <!-- /****** ZP-CODE:2 Remove web-to-print images from the gallery
79
- on personalization form ******/ -->
80
 
81
- <?php $this->helper('webtoprint/personalization-form')->prepare_gallery_images($this, true) ?>
82
 
83
- <!-- /****** ZP-CODE:2 End ******/ -->
84
 
85
  <?php if (count($this->getGalleryImages()) > 0): ?>
86
  <div class="more-views">
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
59
  <?php else: ?>
60
  <p class="product-image">
61
  <?php
 
62
 
63
+ /****** ZP-CODE:1 Set correct image type and image label ******/
 
 
 
 
 
 
64
 
65
+ $_imageType = $this->helper('webtoprint/2step')->getImageType('image');
66
+ $_imageLabel = $this->helper('webtoprint/2step')->getImageLabel($this);
67
 
68
  /****** ZP-CODE:1 End ******/
69
+
70
+ /****** ZP-CODE:2 Add ID attribute to the element.
71
+ Replace image type and image label ******/
72
+
73
+ $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, $_imageType)->resize(265).'" alt="'.$this->escapeHtml($_imageLabel).'" title="'.$this->escapeHtml($_imageLabel).'" />';
74
+
75
+ /****** ZP-CODE:2 End ******/
76
+
77
+ /****** ZP-CODE:3 Replace image type ******/
78
+
79
+ echo $_helper->productAttribute($_product, $_img, $_imageType);
80
+
81
+ /****** ZP-CODE:3 End ******/
82
+
83
  ?>
84
  </p>
85
  <?php endif; ?>
86
 
87
+ <!-- /****** ZP-CODE:4 Remove web-to-print images from the gallery
88
+ on personalisation form ******/ -->
89
 
90
+ <?php $this->helper('webtoprint/personalization-form')->prepare_gallery_images($this) ?>
91
 
92
+ <!-- /****** ZP-CODE:4 End ******/ -->
93
 
94
  <?php if (count($this->getGalleryImages()) > 0): ?>
95
  <div class="more-views">
app/design/frontend/default/zptheme/etc/theme.xml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <theme>
4
+ <parent>default/default</parent>
5
+ </theme>
app/design/frontend/default/zptheme/template/catalog/product/view.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
@@ -50,7 +50,8 @@
50
 
51
  <form action="<?php echo $actionUrl; ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
52
 
53
- <!-- /****** ZP-CODE:1 Printing image tabs for multipage products with web-to-print feature ******/ -->
 
54
 
55
  <?php $this->helper('webtoprint/personalization-form')->get_page_tabs($this); ?>
56
 
@@ -93,14 +94,14 @@
93
  </div>
94
  <?php endif; ?>
95
 
96
- <!-- /****** ZP-CODE:2 Display button which shows data sets ******/ -->
97
 
98
  <?php $this->helper('webtoprint/personalization-form')->getDataSetTable($this); ?>
99
 
100
  <!-- /****** ZP-CODE:2 End ******/ -->
101
 
102
 
103
- <!-- /****** ZP-CODE:3 Display input fields, images, stock images,
104
  colour pickers and palettes for products
105
  with web-to-print feature ******/ -->
106
 
@@ -125,17 +126,17 @@
125
 
126
  </div>
127
 
128
- <!-- /****** ZP-CHANGE: 1 Add ID attribute to the element.
129
- Required by web-to-print JS code ******/ -->
130
 
131
  <div id="zetaprints-preview-image-container" class="product-img-box">
132
 
133
- <!-- /****** ZP-CHANGE: 1 End ******/ -->
134
 
135
  <?php echo $this->getChildHtml('media') ?>
136
  </div>
137
 
138
- <!-- /****** ZP-CODE:4 Output web-to-print button for products
139
  with web-to-print feature ******/ -->
140
 
141
  <?php echo $this->getChildHtml('webtoprint_buttons'); ?>
@@ -209,7 +210,7 @@
209
  </div>
210
  </div>
211
 
212
- <!-- /****** ZP-CODE:5 Printing JavaScript for magento personalization form ******/ -->
213
 
214
  <?php $this->helper('webtoprint/personalization-form')->get_js($this); ?>
215
 
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
50
 
51
  <form action="<?php echo $actionUrl; ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
52
 
53
+ <!-- /****** ZP-CODE:1 Output image tabs for multipage products
54
+ with web-to-print feature ******/ -->
55
 
56
  <?php $this->helper('webtoprint/personalization-form')->get_page_tabs($this); ?>
57
 
94
  </div>
95
  <?php endif; ?>
96
 
97
+ <!-- /****** ZP-CODE:2 Output button for showing data sets ******/ -->
98
 
99
  <?php $this->helper('webtoprint/personalization-form')->getDataSetTable($this); ?>
100
 
101
  <!-- /****** ZP-CODE:2 End ******/ -->
102
 
103
 
104
+ <!-- /****** ZP-CODE:3 Output input fields, images, stock images,
105
  colour pickers and palettes for products
106
  with web-to-print feature ******/ -->
107
 
126
 
127
  </div>
128
 
129
+ <!-- /****** ZP-CHANGE:1 Add ID attribute to the element.
130
+ Required by web-to-print JS code ******/ -->
131
 
132
  <div id="zetaprints-preview-image-container" class="product-img-box">
133
 
134
+ <!-- /****** ZP-CHANGE:1 End ******/ -->
135
 
136
  <?php echo $this->getChildHtml('media') ?>
137
  </div>
138
 
139
+ <!-- /****** ZP-CODE:4 Output web-to-print buttons for products
140
  with web-to-print feature ******/ -->
141
 
142
  <?php echo $this->getChildHtml('webtoprint_buttons'); ?>
210
  </div>
211
  </div>
212
 
213
+ <!-- /****** ZP-CODE:5 Output JavaScript for personalisation form ******/ -->
214
 
215
  <?php $this->helper('webtoprint/personalization-form')->get_js($this); ?>
216
 
app/design/frontend/default/zptheme/template/catalog/product/view/addto.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
app/design/frontend/default/zptheme/template/catalog/product/view/addtocart.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
@@ -32,13 +32,7 @@
32
  <label for="qty"><?php echo $this->__('Qty:') ?></label>
33
  <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
34
  <?php endif; ?>
35
-
36
- <!-- /****** ZP-CHANGE: 1 Add ID attribute to the element. ******/ -->
37
-
38
- <button id="zetaprints-add-to-cart-button" type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
39
-
40
- <!-- /****** ZP-CHANGE: 1 End ******/ -->
41
-
42
  <?php echo $this->getChildHtml('', true, true) ?>
43
  </div>
44
  <?php endif; ?>
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
32
  <label for="qty"><?php echo $this->__('Qty:') ?></label>
33
  <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
34
  <?php endif; ?>
35
+ <button type="button" title="<?php echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
 
 
 
 
 
 
36
  <?php echo $this->getChildHtml('', true, true) ?>
37
  </div>
38
  <?php endif; ?>
app/design/frontend/default/zptheme/template/catalog/product/view/media.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
@@ -60,12 +60,12 @@
60
  <p class="product-image">
61
  <?php
62
 
63
- /****** ZP-CHANGE: 1 Add ID attribute to the element.
64
- Required by web-to-print JS code ******/
65
 
66
  $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
67
 
68
- /****** ZP-CHANGE: 1 End ******/
69
 
70
  echo $_helper->productAttribute($_product, $_img, 'image');
71
  ?>
@@ -73,7 +73,7 @@
73
  <?php endif; ?>
74
 
75
  <!-- /****** ZP-CODE:1 Remove web-to-print images from the gallery
76
- on personalization form ******/ -->
77
 
78
  <?php $this->helper('webtoprint/personalization-form')->prepare_gallery_images($this) ?>
79
 
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
60
  <p class="product-image">
61
  <?php
62
 
63
+ /****** ZP-CHANGE:1 Add ID attribute to the element.
64
+ Required by web-to-print JS code ******/
65
 
66
  $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
67
 
68
+ /****** ZP-CHANGE:1 End ******/
69
 
70
  echo $_helper->productAttribute($_product, $_img, 'image');
71
  ?>
73
  <?php endif; ?>
74
 
75
  <!-- /****** ZP-CODE:1 Remove web-to-print images from the gallery
76
+ on personalisation form ******/ -->
77
 
78
  <?php $this->helper('webtoprint/personalization-form')->prepare_gallery_images($this) ?>
79
 
app/design/frontend/default/zptheme/template/checkout/cart/item/default.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
@@ -42,10 +42,10 @@ else
42
  <tr>
43
  <td>
44
 
45
- <!-- /****** ZP-CODE:1 Outputs link and slightly modified <img> tag to
46
- prevent image resizing with correct image url
47
- and returns true for products with web-to-print
48
- features ******/ -->
49
 
50
  <?php if(!$this->helper('webtoprint/personalization-form')->get_cart_image($this)): ?>
51
  <?php if ($this->hasProductUrl()):?><a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><?php endif;?><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /><?php if ($this->hasProductUrl()):?></a><?php endif;?>
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
42
  <tr>
43
  <td>
44
 
45
+ <!-- /****** ZP-CODE:1 Output link and slightly modified <img> tag with
46
+ correct image url, add link to PDF proof
47
+ for the template and returns true for products
48
+ with web-to-print features ******/ -->
49
 
50
  <?php if(!$this->helper('webtoprint/personalization-form')->get_cart_image($this)): ?>
51
  <?php if ($this->hasProductUrl()):?><a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><?php endif;?><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /><?php if ($this->hasProductUrl()):?></a><?php endif;?>
app/design/frontend/default/zptheme/template/sales/order/items.phtml CHANGED
@@ -20,14 +20,13 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
  <?php $_order = $this->getOrder() ?>
28
 
29
- <!-- /****** ZP-CODE:1 Inserting link to hide/show all previews
30
- one time *****/ -->
31
 
32
  <?php echo $this->helper('webtoprint/personalization-form')
33
  ->show_hide_all_order_previews($this); ?>
@@ -73,8 +72,8 @@
73
  </tr>
74
  <?php endif ?>
75
 
76
- <!-- /****** ZP-CODE:2 Inserting preview images for web-to-print products
77
- from order *****/ -->
78
 
79
  <?php $this->helper('webtoprint/personalization-form')->get_order_preview_images($this, $_item); ?>
80
 
@@ -85,7 +84,7 @@
85
  </table>
86
  <script type="text/javascript">decorateTable('my-orders-table', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
87
 
88
- <!-- /****** ZP-CODE:3 Inserting javascript code for previews images *****/ -->
89
 
90
  <?php $this->helper('webtoprint/personalization-form')->get_js_for_order_preview_images($this); ?>
91
 
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
27
  <?php $_order = $this->getOrder() ?>
28
 
29
+ <!-- /****** ZP-CODE:1 Insert link to hide/show all previews *****/ -->
 
30
 
31
  <?php echo $this->helper('webtoprint/personalization-form')
32
  ->show_hide_all_order_previews($this); ?>
72
  </tr>
73
  <?php endif ?>
74
 
75
+ <!-- /****** ZP-CODE:2 Insert preview images from the order
76
+ for web-to-print products *****/ -->
77
 
78
  <?php $this->helper('webtoprint/personalization-form')->get_order_preview_images($this, $_item); ?>
79
 
84
  </table>
85
  <script type="text/javascript">decorateTable('my-orders-table', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
86
 
87
+ <!-- /****** ZP-CODE:3 Inserting javascript code for previews images *****/ -->
88
 
89
  <?php $this->helper('webtoprint/personalization-form')->get_js_for_order_preview_images($this); ?>
90
 
app/design/frontend/default/zptheme/template/sales/order/items/renderer/default.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
@@ -61,13 +61,13 @@
61
  <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" onclick="return giftMessageToogle('<?php echo $_item->getId() ?>')"><?php echo $this->__('Gift Message') ?></a>
62
  <?php endif; ?>
63
 
64
- <!-- /****** ZP-CODE:1 Inserting links to web-to-print generated files *****/ -->
65
 
66
  <?php echo $this->helper('webtoprint/personalization-form')->get_order_webtoprint_links($this, $_item); ?>
67
 
68
  <!-- /****** ZP-CODE:1 End ******/ -->
69
 
70
- <!-- /****** ZP-CODE:2 Inserting link for re-order *****/ -->
71
 
72
  <?php echo $this->helper('webtoprint/personalization-form')->get_reorder_button($this, $_item); ?>
73
 
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
61
  <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" onclick="return giftMessageToogle('<?php echo $_item->getId() ?>')"><?php echo $this->__('Gift Message') ?></a>
62
  <?php endif; ?>
63
 
64
+ <!-- /****** ZP-CODE:1 Output links to web-to-print generated files *****/ -->
65
 
66
  <?php echo $this->helper('webtoprint/personalization-form')->get_order_webtoprint_links($this, $_item); ?>
67
 
68
  <!-- /****** ZP-CODE:1 End ******/ -->
69
 
70
+ <!-- /****** ZP-CODE:2 Output link for re-ordering *****/ -->
71
 
72
  <?php echo $this->helper('webtoprint/personalization-form')->get_reorder_button($this, $_item); ?>
73
 
app/design/frontend/default/zptheme/template/wishlist/item/column/image.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
@@ -29,8 +29,8 @@ $item = $this->getItem();
29
  $product = $item->getProduct();
30
  ?>
31
 
32
- <!-- /****** ZP-CODE:1 Outputs link and slightly modified <img> tag to
33
- prevent image resizing with correct image url
34
  and returns true for products with web-to-print
35
  features ******/ -->
36
 
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
 
29
  $product = $item->getProduct();
30
  ?>
31
 
32
+ <!-- /****** ZP-CODE:1 Output link and slightly modified <img> tag with correct
33
+ image url, add link to PDF proof for the template
34
  and returns true for products with web-to-print
35
  features ******/ -->
36
 
js/colorpicker/colorpicker.css DELETED
@@ -1,187 +0,0 @@
1
- .colorpicker {
2
- width: 356px;
3
- height: 176px;
4
- overflow: hidden;
5
- position: absolute;
6
- background: url(images/colorpicker_background.png);
7
- font-family: Arial, Helvetica, sans-serif;
8
- display: none;
9
- z-index: 5;
10
- }
11
- .colorpicker_color {
12
- width: 150px;
13
- height: 150px;
14
- left: 14px;
15
- top: 13px;
16
- position: absolute;
17
- background: #f00;
18
- overflow: hidden;
19
- cursor: crosshair;
20
- }
21
- .colorpicker_color div {
22
- position: absolute;
23
- top: 0;
24
- left: 0;
25
- width: 150px;
26
- height: 150px;
27
- background: url(images/colorpicker_overlay.png);
28
- }
29
- .colorpicker_color div div {
30
- position: absolute;
31
- top: 0;
32
- left: 0;
33
- width: 11px;
34
- height: 11px;
35
- overflow: hidden;
36
- background: url(images/colorpicker_select.gif);
37
- margin: -5px 0 0 -5px;
38
- }
39
- .colorpicker_hue {
40
- position: absolute;
41
- top: 13px;
42
- left: 171px;
43
- width: 35px;
44
- height: 150px;
45
- cursor: n-resize;
46
- }
47
- .colorpicker_hue div {
48
- position: absolute;
49
- width: 35px;
50
- height: 9px;
51
- overflow: hidden;
52
- background: url(images/colorpicker_indic.gif) left top;
53
- margin: -4px 0 0 0;
54
- left: 0px;
55
- }
56
- .colorpicker_new_color {
57
- position: absolute;
58
- width: 60px;
59
- height: 30px;
60
- left: 213px;
61
- top: 13px;
62
- background: #f00;
63
- }
64
- .colorpicker_current_color {
65
- position: absolute;
66
- width: 60px;
67
- height: 30px;
68
- left: 283px;
69
- top: 13px;
70
- background: #f00;
71
- display: none;
72
- }
73
- .colorpicker input {
74
- background-color: transparent;
75
- border: 1px solid transparent;
76
- position: absolute;
77
- font-size: 10px;
78
- font-family: Arial, Helvetica, sans-serif;
79
- color: #898989;
80
- top: 4px;
81
- right: 11px;
82
- text-align: right;
83
- margin: 0;
84
- padding: 0;
85
- height: 11px;
86
- }
87
- .colorpicker_hex {
88
- position: absolute;
89
- width: 72px;
90
- height: 22px;
91
- background: url(images/colorpicker_hex.png) top;
92
- left: 212px;
93
- top: 142px;
94
- }
95
- .colorpicker_hex input {
96
- right: 6px;
97
- }
98
- .colorpicker_field {
99
- height: 22px;
100
- width: 62px;
101
- background-position: top;
102
- position: absolute;
103
- }
104
- .colorpicker_field span {
105
- position: absolute;
106
- width: 12px;
107
- height: 22px;
108
- overflow: hidden;
109
- top: 0;
110
- right: 0;
111
- cursor: n-resize;
112
- }
113
- .colorpicker_rgb_r {
114
- background-image: url(images/colorpicker_rgb_r.png);
115
- top: 52px;
116
- left: 212px;
117
- }
118
- .colorpicker_rgb_g {
119
- background-image: url(images/colorpicker_rgb_g.png);
120
- top: 82px;
121
- left: 212px;
122
- }
123
- .colorpicker_rgb_b {
124
- background-image: url(images/colorpicker_rgb_b.png);
125
- top: 112px;
126
- left: 212px;
127
- }
128
- .colorpicker_hsb_h {
129
- display: none;
130
- background-image: url(images/colorpicker_hsb_h.png);
131
- top: 52px;
132
- left: 282px;
133
- }
134
- .colorpicker_hsb_s {
135
- display: none;
136
- background-image: url(images/colorpicker_hsb_s.png);
137
- top: 82px;
138
- left: 282px;
139
- }
140
- .colorpicker_hsb_b {
141
- display: none;
142
- background-image: url(images/colorpicker_hsb_b.png);
143
- top: 112px;
144
- left: 282px;
145
- }
146
- .colorpicker_submit {
147
- position: absolute;
148
- width: 54px;
149
- height: 20px;
150
- /*background: url(images/colorpicker_submit.png) top;*/
151
- left: 290px;
152
- top: 112px;
153
- overflow: hidden;
154
- border: 1px solid;
155
- color: #898989;
156
- cursor: pointer;
157
- font-size: 12px;
158
- line-height: 1.55;
159
- text-align: center;
160
- }
161
- .colorpicker_cancel {
162
- position: absolute;
163
- width: 54px;
164
- height: 20px;
165
- /*background: url(images/colorpicker_submit.png) top;*/
166
- left: 290px;
167
- top: 140px;
168
- overflow: hidden;
169
- border: 1px solid;
170
- color: #898989;
171
- cursor: pointer;
172
- font-size: 12px;
173
- line-height: 1.55;
174
- text-align: center;
175
- }
176
- .colorpicker_focus {
177
- background-position: center;
178
- }
179
- .colorpicker_hex.colorpicker_focus {
180
- background-position: bottom;
181
- }
182
- .colorpicker_submit.colorpicker_focus {
183
- background-position: bottom;
184
- }
185
- .colorpicker_slider {
186
- background-position: bottom;
187
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/colorpicker/colorpicker.js DELETED
@@ -1,554 +0,0 @@
1
- /**
2
- *
3
- * Color picker
4
- * Author: Stefan Petre www.eyecon.ro
5
- *
6
- * Dual licensed under the MIT and GPL licenses
7
- *
8
- */
9
- (function ($) {
10
- var ColorPicker = function () {
11
- var
12
- ids = {},
13
- inAction,
14
- charMin = 65,
15
- visible,
16
- tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit">Select</div><div class="colorpicker_cancel">Cancel</div></div>',
17
- defaults = {
18
- eventName: 'click',
19
- onShow: function () {},
20
- onBeforeShow: function(){},
21
- onHide: function () {},
22
- onChange: function () {},
23
- onSubmit: function () {},
24
- color: 'ff0000',
25
- livePreview: true,
26
- flat: false
27
- },
28
- fillRGBFields = function (hsb, cal) {
29
- var rgb = HSBToRGB(hsb);
30
- $(cal).data('colorpicker').fields
31
- .eq(1).val(rgb.r).end()
32
- .eq(2).val(rgb.g).end()
33
- .eq(3).val(rgb.b).end();
34
- },
35
- fillHSBFields = function (hsb, cal) {
36
- $(cal).data('colorpicker').fields
37
- .eq(4).val(hsb.h).end()
38
- .eq(5).val(hsb.s).end()
39
- .eq(6).val(hsb.b).end();
40
- },
41
- fillHexFields = function (hsb, cal) {
42
- $(cal).data('colorpicker').fields
43
- .eq(0).val(HSBToHex(hsb)).end();
44
- },
45
- setSelector = function (hsb, cal) {
46
- $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
47
- $(cal).data('colorpicker').selectorIndic.css({
48
- left: parseInt(150 * hsb.s/100, 10),
49
- top: parseInt(150 * (100-hsb.b)/100, 10)
50
- });
51
- },
52
- setHue = function (hsb, cal) {
53
- $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
54
- },
55
- setCurrentColor = function (hsb, cal) {
56
- $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
57
- },
58
- setNewColor = function (hsb, cal) {
59
- $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
60
- },
61
- keyDown = function (ev) {
62
- var pressedKey = ev.charCode || ev.keyCode || -1;
63
- if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
64
- return false;
65
- }
66
- var cal = $(this).parent().parent();
67
- if (cal.data('colorpicker').livePreview === true) {
68
- change.apply(this);
69
- }
70
- },
71
- change = function (ev) {
72
- var cal = $(this).parent().parent(), col;
73
- if (this.parentNode.className.indexOf('_hex') > 0) {
74
- cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
75
- } else if (this.parentNode.className.indexOf('_hsb') > 0) {
76
- cal.data('colorpicker').color = col = fixHSB({
77
- h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
78
- s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
79
- b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
80
- });
81
- } else {
82
- cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
83
- r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
84
- g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
85
- b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
86
- }));
87
- }
88
- if (ev) {
89
- fillRGBFields(col, cal.get(0));
90
- fillHexFields(col, cal.get(0));
91
- fillHSBFields(col, cal.get(0));
92
- }
93
- setSelector(col, cal.get(0));
94
- setHue(col, cal.get(0));
95
- setNewColor(col, cal.get(0));
96
- cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
97
- },
98
- blur = function (ev) {
99
- var cal = $(this).parent().parent();
100
- cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
101
- },
102
- focus = function () {
103
- charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
104
- $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
105
- $(this).parent().addClass('colorpicker_focus');
106
- },
107
- downIncrement = function (ev) {
108
- var field = $(this).parent().find('input').focus();
109
- var current = {
110
- el: $(this).parent().addClass('colorpicker_slider'),
111
- max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
112
- y: ev.pageY,
113
- field: field,
114
- val: parseInt(field.val(), 10),
115
- preview: $(this).parent().parent().data('colorpicker').livePreview
116
- };
117
- $(document).bind('mouseup', current, upIncrement);
118
- $(document).bind('mousemove', current, moveIncrement);
119
- return false;
120
- },
121
- moveIncrement = function (ev) {
122
- ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
123
- if (ev.data.preview) {
124
- change.apply(ev.data.field.get(0), [true]);
125
- }
126
- return false;
127
- },
128
- upIncrement = function (ev) {
129
- change.apply(ev.data.field.get(0), [true]);
130
- ev.data.el.removeClass('colorpicker_slider').find('input').focus();
131
- $(document).unbind('mouseup', upIncrement);
132
- $(document).unbind('mousemove', moveIncrement);
133
- return false;
134
- },
135
- downHue = function (ev) {
136
- var current = {
137
- cal: $(this).parent(),
138
- y: $(this).offset().top
139
- };
140
- current.preview = current.cal.data('colorpicker').livePreview;
141
- $(document).bind('mouseup', current, upHue);
142
- $(document).bind('mousemove', current, moveHue);
143
- },
144
- moveHue = function (ev) {
145
- change.apply(
146
- ev.data.cal.data('colorpicker')
147
- .fields
148
- .eq(4)
149
- .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
150
- .get(0),
151
- [ev.data.preview]
152
- );
153
- return false;
154
- },
155
- upHue = function (ev) {
156
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
157
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
158
- $(document).unbind('mouseup', upHue);
159
- $(document).unbind('mousemove', moveHue);
160
- return false;
161
- },
162
- clickHue = function (ev) {
163
- var current = {
164
- cal: $(this).parent(),
165
- y: $(this).offset().top
166
- };
167
- current.preview = current.cal.data('colorpicker').livePreview;
168
-
169
- change.apply(
170
- current.cal.data('colorpicker')
171
- .fields
172
- .eq(4)
173
- .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - current.y))))/150, 10))
174
- .get(0),
175
- [current.preview]
176
- );
177
- fillRGBFields(current.cal.data('colorpicker').color, current.cal.get(0));
178
- fillHexFields(current.cal.data('colorpicker').color, current.cal.get(0));
179
- return false;
180
- },
181
- downSelector = function (ev) {
182
- var current = {
183
- cal: $(this).parent(),
184
- pos: $(this).offset()
185
- };
186
- current.preview = current.cal.data('colorpicker').livePreview;
187
- $(document).bind('mouseup', current, upSelector);
188
- $(document).bind('mousemove', current, moveSelector);
189
- },
190
- moveSelector = function (ev) {
191
- change.apply(
192
- ev.data.cal.data('colorpicker')
193
- .fields
194
- .eq(6)
195
- .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
196
- .end()
197
- .eq(5)
198
- .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
199
- .get(0),
200
- [ev.data.preview]
201
- );
202
- return false;
203
- },
204
- upSelector = function (ev) {
205
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
206
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
207
- $(document).unbind('mouseup', upSelector);
208
- $(document).unbind('mousemove', moveSelector);
209
- return false;
210
- },
211
- clickSelector = function (ev) {
212
- var current = {
213
- cal: $(this).parent(),
214
- pos: $(this).offset()
215
- };
216
- current.preview = current.cal.data('colorpicker').livePreview;
217
-
218
- change.apply(
219
- current.cal.data('colorpicker')
220
- .fields
221
- .eq(6)
222
- .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - current.pos.top))))/150, 10))
223
- .end()
224
- .eq(5)
225
- .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - current.pos.left))))/150, 10))
226
- .get(0),
227
- [current.preview]
228
- );
229
-
230
- fillRGBFields(current.cal.data('colorpicker').color, current.cal.get(0));
231
- fillHexFields(current.cal.data('colorpicker').color, current.cal.get(0));
232
-
233
- return false;
234
- },
235
- enterSubmit = function (ev) {
236
- $(this).addClass('colorpicker_focus');
237
- },
238
- leaveSubmit = function (ev) {
239
- $(this).removeClass('colorpicker_focus');
240
- },
241
- clickSubmit = function (ev) {
242
- var cal = $(this).parent();
243
- var col = cal.data('colorpicker').color;
244
- cal.data('colorpicker').origColor = col;
245
- setCurrentColor(col, cal.get(0));
246
- cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
247
-
248
- return false;
249
- },
250
- enterCancel = function (ev) {
251
- $(this).addClass('colorpicker_focus');
252
- },
253
- leaveCancel = function (ev) {
254
- $(this).removeClass('colorpicker_focus');
255
- },
256
- clickCancel = function (ev) {
257
- if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
258
- ev.data.cal.hide();
259
- }
260
-
261
- $(document).unbind('mousedown', hide);
262
-
263
- return false;
264
- },
265
- show = function (ev) {
266
- var cal = $('#' + $(this).data('colorpickerId'));
267
- cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
268
- var pos = $(this).offset();
269
- var viewPort = getViewport();
270
- var top = pos.top + this.offsetHeight;
271
- var left = pos.left;
272
- if (top + 176 > viewPort.t + viewPort.h) {
273
- top -= this.offsetHeight + 176;
274
- }
275
- if (left + 356 > viewPort.l + viewPort.w) {
276
- left -= 356;
277
- }
278
- cal.css({left: left + 'px', top: top + 'px'});
279
- if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
280
- cal.show();
281
- }
282
- $(document).bind('mousedown', {cal: cal}, hide);
283
- return false;
284
- },
285
- hide = function (ev) {
286
- if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
287
- if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
288
- ev.data.cal.hide();
289
- }
290
- $(document).unbind('mousedown', hide);
291
- }
292
-
293
- return false;
294
- },
295
- isChildOf = function(parentEl, el, container) {
296
- if (parentEl == el) {
297
- return true;
298
- }
299
- if (parentEl.contains) {
300
- return parentEl.contains(el);
301
- }
302
- if ( parentEl.compareDocumentPosition ) {
303
- return !!(parentEl.compareDocumentPosition(el) & 16);
304
- }
305
- var prEl = el.parentNode;
306
- while(prEl && prEl != container) {
307
- if (prEl == parentEl)
308
- return true;
309
- prEl = prEl.parentNode;
310
- }
311
- return false;
312
- },
313
- getViewport = function () {
314
- var m = document.compatMode == 'CSS1Compat';
315
- return {
316
- l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
317
- t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
318
- w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
319
- h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
320
- };
321
- },
322
- fixHSB = function (hsb) {
323
- return {
324
- h: Math.min(360, Math.max(0, hsb.h)),
325
- s: Math.min(100, Math.max(0, hsb.s)),
326
- b: Math.min(100, Math.max(0, hsb.b))
327
- };
328
- },
329
- fixRGB = function (rgb) {
330
- return {
331
- r: Math.min(255, Math.max(0, rgb.r)),
332
- g: Math.min(255, Math.max(0, rgb.g)),
333
- b: Math.min(255, Math.max(0, rgb.b))
334
- };
335
- },
336
- fixHex = function (hex) {
337
- var len = 6 - hex.length;
338
- if (len > 0) {
339
- var o = [];
340
- for (var i=0; i<len; i++) {
341
- o.push('0');
342
- }
343
- o.push(hex);
344
- hex = o.join('');
345
- }
346
- return hex;
347
- },
348
- HexToRGB = function (hex) {
349
- var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
350
- return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
351
- },
352
- HexToHSB = function (hex) {
353
- return RGBToHSB(HexToRGB(hex));
354
- },
355
- RGBToHSB = function (rgb) {
356
- var hsb = {
357
- h: 0,
358
- s: 0,
359
- b: 0
360
- };
361
- var min = Math.min(rgb.r, rgb.g, rgb.b);
362
- var max = Math.max(rgb.r, rgb.g, rgb.b);
363
- var delta = max - min;
364
- hsb.b = max;
365
- if (max != 0) {
366
-
367
- }
368
- hsb.s = max != 0 ? 255 * delta / max : 0;
369
- if (hsb.s != 0) {
370
- if (rgb.r == max) {
371
- hsb.h = (rgb.g - rgb.b) / delta;
372
- } else if (rgb.g == max) {
373
- hsb.h = 2 + (rgb.b - rgb.r) / delta;
374
- } else {
375
- hsb.h = 4 + (rgb.r - rgb.g) / delta;
376
- }
377
- } else {
378
- hsb.h = -1;
379
- }
380
- hsb.h *= 60;
381
- if (hsb.h < 0) {
382
- hsb.h += 360;
383
- }
384
- hsb.s *= 100/255;
385
- hsb.b *= 100/255;
386
- return hsb;
387
- },
388
- HSBToRGB = function (hsb) {
389
- var rgb = {};
390
- var h = Math.round(hsb.h);
391
- var s = Math.round(hsb.s*255/100);
392
- var v = Math.round(hsb.b*255/100);
393
- if(s == 0) {
394
- rgb.r = rgb.g = rgb.b = v;
395
- } else {
396
- var t1 = v;
397
- var t2 = (255-s)*v/255;
398
- var t3 = (t1-t2)*(h%60)/60;
399
- if(h==360) h = 0;
400
- if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
401
- else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
402
- else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
403
- else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
404
- else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
405
- else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
406
- else {rgb.r=0; rgb.g=0; rgb.b=0}
407
- }
408
- return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
409
- },
410
- RGBToHex = function (rgb) {
411
- var hex = [
412
- rgb.r.toString(16),
413
- rgb.g.toString(16),
414
- rgb.b.toString(16)
415
- ];
416
- $.each(hex, function (nr, val) {
417
- if (val.length == 1) {
418
- hex[nr] = '0' + val;
419
- }
420
- });
421
- return hex.join('');
422
- },
423
- HSBToHex = function (hsb) {
424
- return RGBToHex(HSBToRGB(hsb));
425
- },
426
- restoreOriginal = function () {
427
- var cal = $(this).parent();
428
- var col = cal.data('colorpicker').origColor;
429
- cal.data('colorpicker').color = col;
430
- fillRGBFields(col, cal.get(0));
431
- fillHexFields(col, cal.get(0));
432
- fillHSBFields(col, cal.get(0));
433
- setSelector(col, cal.get(0));
434
- setHue(col, cal.get(0));
435
- setNewColor(col, cal.get(0));
436
- };
437
- return {
438
- init: function (opt) {
439
- opt = $.extend({}, defaults, opt||{});
440
- if (typeof opt.color == 'string') {
441
- opt.color = HexToHSB(opt.color);
442
- } else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
443
- opt.color = RGBToHSB(opt.color);
444
- } else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
445
- opt.color = fixHSB(opt.color);
446
- } else {
447
- return this;
448
- }
449
- return this.each(function () {
450
- if (!$(this).data('colorpickerId')) {
451
- var options = $.extend({}, opt);
452
- options.origColor = opt.color;
453
- var id = 'collorpicker_' + parseInt(Math.random() * 1000);
454
- $(this).data('colorpickerId', id);
455
- var cal = $(tpl).attr('id', id);
456
- if (options.flat) {
457
- cal.appendTo(this).show();
458
- } else {
459
- cal.appendTo(document.body);
460
- }
461
- options.fields = cal
462
- .find('input')
463
- .bind('keyup', keyDown)
464
- .bind('change', change)
465
- .bind('blur', blur)
466
- .bind('focus', focus);
467
- cal
468
- .find('span').bind('mousedown', downIncrement).end()
469
- .find('>div.colorpicker_current_color').bind('click', restoreOriginal);
470
- options.selector = cal.find('div.colorpicker_color').click(clickSelector).mousedown(function(){ return false; });
471
- options.selectorIndic = options.selector.find('div div');
472
- options.el = this;
473
- options.hue = cal.find('div.colorpicker_hue div');
474
- cal.find('div.colorpicker_hue').click(clickHue).mousedown(function(){ return false; });
475
- options.newColor = cal.find('div.colorpicker_new_color');
476
- options.currentColor = cal.find('div.colorpicker_current_color');
477
- cal.data('colorpicker', options);
478
- cal.find('div.colorpicker_submit')
479
- .bind('mouseenter', enterSubmit)
480
- .bind('mouseleave', leaveSubmit)
481
- .bind('click', clickSubmit);
482
- cal.find('div.colorpicker_cancel')
483
- .bind('mouseenter', enterCancel)
484
- .bind('mouseleave', leaveCancel)
485
- .bind('click', {cal: cal}, clickCancel);
486
- fillRGBFields(options.color, cal.get(0));
487
- fillHSBFields(options.color, cal.get(0));
488
- fillHexFields(options.color, cal.get(0));
489
- setHue(options.color, cal.get(0));
490
- setSelector(options.color, cal.get(0));
491
- setCurrentColor(options.color, cal.get(0));
492
- setNewColor(options.color, cal.get(0));
493
- if (options.flat) {
494
- cal.css({
495
- position: 'relative',
496
- display: 'block'
497
- });
498
- } else {
499
- $(this).bind(options.eventName, show);
500
- }
501
- }
502
- });
503
- },
504
- showPicker: function() {
505
- return this.each( function () {
506
- if ($(this).data('colorpickerId')) {
507
- show.apply(this);
508
- }
509
- });
510
- },
511
- hidePicker: function() {
512
- return this.each( function () {
513
- if ($(this).data('colorpickerId')) {
514
- var cal = $('#' + $(this).data('colorpickerId'));
515
- if (cal.data('colorpicker').onHide.apply(this, [cal.get(0)]) != false) {
516
- cal.hide();
517
- }
518
- }
519
- });
520
- },
521
- setColor: function(col) {
522
- if (typeof col == 'string') {
523
- col = HexToHSB(col);
524
- } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
525
- col = RGBToHSB(col);
526
- } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
527
- col = fixHSB(col);
528
- } else {
529
- return this;
530
- }
531
- return this.each(function(){
532
- if ($(this).data('colorpickerId')) {
533
- var cal = $('#' + $(this).data('colorpickerId'));
534
- cal.data('colorpicker').color = col;
535
- cal.data('colorpicker').origColor = col;
536
- fillRGBFields(col, cal.get(0));
537
- fillHSBFields(col, cal.get(0));
538
- fillHexFields(col, cal.get(0));
539
- setHue(col, cal.get(0));
540
- setSelector(col, cal.get(0));
541
- setCurrentColor(col, cal.get(0));
542
- setNewColor(col, cal.get(0));
543
- }
544
- });
545
- }
546
- };
547
- }();
548
- $.fn.extend({
549
- ColorPicker: ColorPicker.init,
550
- ColorPickerHide: ColorPicker.hidePicker,
551
- ColorPickerShow: ColorPicker.showPicker,
552
- ColorPickerSetColor: ColorPicker.setColor
553
- });
554
- })(jQuery)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/colorpicker/images/blank.gif DELETED
Binary file
js/colorpicker/images/colorpicker_background.png DELETED
Binary file
js/colorpicker/images/colorpicker_hex.png DELETED
Binary file
js/colorpicker/images/colorpicker_hsb_b.png DELETED
Binary file
js/colorpicker/images/colorpicker_hsb_h.png DELETED
Binary file
js/colorpicker/images/colorpicker_hsb_s.png DELETED
Binary file
js/colorpicker/images/colorpicker_indic.gif DELETED
Binary file
js/colorpicker/images/colorpicker_overlay.png DELETED
Binary file
js/colorpicker/images/colorpicker_rgb_b.png DELETED
Binary file
js/colorpicker/images/colorpicker_rgb_g.png DELETED
Binary file
js/colorpicker/images/colorpicker_rgb_r.png DELETED
Binary file
js/colorpicker/images/colorpicker_select.gif DELETED
Binary file
js/colorpicker/images/colorpicker_submit.png DELETED
Binary file
js/colorpicker/images/custom_background.png DELETED
Binary file
js/colorpicker/images/custom_hex.png DELETED
Binary file
js/colorpicker/images/custom_hsb_b.png DELETED
Binary file
js/colorpicker/images/custom_hsb_h.png DELETED
Binary file
js/colorpicker/images/custom_hsb_s.png DELETED
Binary file
js/colorpicker/images/custom_indic.gif DELETED
Binary file
js/colorpicker/images/custom_rgb_b.png DELETED
Binary file
js/colorpicker/images/custom_rgb_g.png DELETED
Binary file
js/colorpicker/images/custom_rgb_r.png DELETED
Binary file
js/colorpicker/images/custom_submit.png DELETED
Binary file
js/colorpicker/images/select.png DELETED
Binary file
js/colorpicker/images/select2.png DELETED
Binary file
js/colorpicker/images/slider.png DELETED
Binary file
js/jquery/jquery-ui-custom-min.js CHANGED
@@ -28,6 +28,10 @@
28
  * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
29
  (function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.isMultiLine=this.element.is("textarea"),this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(b.options.disabled||b.element.propAttr("readOnly"))return;d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._keyEvent("previous",c);break;case e.DOWN:b._keyEvent("next",c);break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){if(b.options.disabled)return;b.selectedItem=null,b.previous=b.element.val()}).bind("blur.autocomplete",function(a){if(b.options.disabled)return;clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150)}),this._initSource(),this.menu=a("<ul></ul>").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,c,d;a.isArray(this.options.source)?(c=this.options.source,this.source=function(b,d){d(a.ui.autocomplete.filter(c,b.term))}):typeof this.options.source=="string"?(d=this.options.source,this.source=function(c,e){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:d,data:c,dataType:"json",success:function(a,b){e(a)},error:function(){e([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)===!1)return;return this._search(a)},_search:function(a){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.source({term:a},this._response())},_response:function(){var a=this,b=++c;return function(d){b===c&&a.__response(d),a.pending--,a.pending||a.element.removeClass("ui-autocomplete-loading")}},__response:function(a){!this.options.disabled&&a&&a.length?(a=this._normalize(a),this._suggest(a),this._trigger("open")):this.close()},close:function(a){clearTimeout(this.closing),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",a))},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(b){return b.length&&b[0].label&&b[0].value?b:a.map(b,function(b){return typeof b=="string"?{label:b,value:b}:a.extend({label:b.label||b.value,value:b.value||b.label},b)})},_suggest:function(b){var c=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(c,b),this.menu.deactivate(),this.menu.refresh(),c.show(),this._resizeMenu(),c.position(a.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(new a.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(b,c){var d=this;a.each(c,function(a,c){d._renderItem(b,c)})},_renderItem:function(b,c){return a("<li></li>").data("item.autocomplete",c).append(a("<a></a>").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible")){this.search(null,b);return}if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)},widget:function(){return this.menu.element},_keyEvent:function(a,b){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(a,b),b.preventDefault()}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})})(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(!a(c.target).closest(".ui-menu-item a").length)return;c.preventDefault(),b.select(c)}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){if(!this.active)return;this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active){this.activate(c,this.element.children(b));return}var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:first")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[a.fn.prop?"prop":"attr"]("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})}(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28
30
  * https://github.com/jquery/jquery-ui
 
 
 
 
31
  * Includes: jquery.ui.tabs.js
32
  * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
33
  (function(a,b){function e(){return++c}function f(){return++d}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return e.selected=a,!1}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1)return this.blur(),!1;e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected"))return e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur(),!1;if(!f.length)return e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur(),!1}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){return typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']"))),a},destroy:function(){var b=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie),this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);return j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e])),this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();return d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1<this.anchors.length?1:-1)),c.disabled=a.map(a.grep(c.disabled,function(a,c){return a!=b}),function(a,c){return a>=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0])),this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)==-1)return;return this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;return a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))),this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;return this.anchors.eq(a).trigger(this.options.event+".tabs"),this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}return this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(a,b){return this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b),this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.24"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a<c.anchors.length?a:0)},a),b&&b.stopPropagation()}),f=c._unrotate||(c._unrotate=b?function(a){e()}:function(a){a.clientX&&c.rotate(null)});return a?(this.element.bind("tabsshow",e),this.anchors.bind(d.event+".tabs",f),e()):(clearTimeout(c.rotation),this.element.unbind("tabsshow",e),this.anchors.unbind(d.event+".tabs",f),delete this._rotate,delete this._unrotate),this}})})(jQuery);;
28
  * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
29
  (function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.isMultiLine=this.element.is("textarea"),this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(b.options.disabled||b.element.propAttr("readOnly"))return;d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._keyEvent("previous",c);break;case e.DOWN:b._keyEvent("next",c);break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){if(b.options.disabled)return;b.selectedItem=null,b.previous=b.element.val()}).bind("blur.autocomplete",function(a){if(b.options.disabled)return;clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150)}),this._initSource(),this.menu=a("<ul></ul>").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,c,d;a.isArray(this.options.source)?(c=this.options.source,this.source=function(b,d){d(a.ui.autocomplete.filter(c,b.term))}):typeof this.options.source=="string"?(d=this.options.source,this.source=function(c,e){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:d,data:c,dataType:"json",success:function(a,b){e(a)},error:function(){e([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)===!1)return;return this._search(a)},_search:function(a){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.source({term:a},this._response())},_response:function(){var a=this,b=++c;return function(d){b===c&&a.__response(d),a.pending--,a.pending||a.element.removeClass("ui-autocomplete-loading")}},__response:function(a){!this.options.disabled&&a&&a.length?(a=this._normalize(a),this._suggest(a),this._trigger("open")):this.close()},close:function(a){clearTimeout(this.closing),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",a))},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(b){return b.length&&b[0].label&&b[0].value?b:a.map(b,function(b){return typeof b=="string"?{label:b,value:b}:a.extend({label:b.label||b.value,value:b.value||b.label},b)})},_suggest:function(b){var c=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(c,b),this.menu.deactivate(),this.menu.refresh(),c.show(),this._resizeMenu(),c.position(a.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(new a.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(b,c){var d=this;a.each(c,function(a,c){d._renderItem(b,c)})},_renderItem:function(b,c){return a("<li></li>").data("item.autocomplete",c).append(a("<a></a>").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible")){this.search(null,b);return}if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)},widget:function(){return this.menu.element},_keyEvent:function(a,b){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(a,b),b.preventDefault()}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})})(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(!a(c.target).closest(".ui-menu-item a").length)return;c.preventDefault(),b.select(c)}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){if(!this.active)return;this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active){this.activate(c,this.element.children(b));return}var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:first")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[a.fn.prop?"prop":"attr"]("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})}(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28
30
  * https://github.com/jquery/jquery-ui
31
+ * Includes: jquery.ui.button.js
32
+ * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
33
+ (function(a,b){var c,d,e,f,g="ui-button ui-widget ui-state-default ui-corner-all",h="ui-state-hover ui-state-active ",i="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",j=function(){var b=a(this).find(":ui-button");setTimeout(function(){b.button("refresh")},1)},k=function(b){var c=b.name,d=b.form,e=a([]);return c&&(d?e=a(d).find("[name='"+c+"']"):e=a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form})),e};a.widget("ui.button",{options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",j),typeof this.options.disabled!="boolean"?this.options.disabled=!!this.element.propAttr("disabled"):this.element.propAttr("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var b=this,h=this.options,i=this.type==="checkbox"||this.type==="radio",l="ui-state-hover"+(i?"":" ui-state-active"),m="ui-state-focus";h.label===null&&(h.label=this.buttonElement.html()),this.buttonElement.addClass(g).attr("role","button").bind("mouseenter.button",function(){if(h.disabled)return;a(this).addClass("ui-state-hover"),this===c&&a(this).addClass("ui-state-active")}).bind("mouseleave.button",function(){if(h.disabled)return;a(this).removeClass(l)}).bind("click.button",function(a){h.disabled&&(a.preventDefault(),a.stopImmediatePropagation())}),this.element.bind("focus.button",function(){b.buttonElement.addClass(m)}).bind("blur.button",function(){b.buttonElement.removeClass(m)}),i&&(this.element.bind("change.button",function(){if(f)return;b.refresh()}),this.buttonElement.bind("mousedown.button",function(a){if(h.disabled)return;f=!1,d=a.pageX,e=a.pageY}).bind("mouseup.button",function(a){if(h.disabled)return;if(d!==a.pageX||e!==a.pageY)f=!0})),this.type==="checkbox"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).toggleClass("ui-state-active"),b.buttonElement.attr("aria-pressed",b.element[0].checked)}):this.type==="radio"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).addClass("ui-state-active"),b.buttonElement.attr("aria-pressed","true");var c=b.element[0];k(c).not(c).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown.button",function(){if(h.disabled)return!1;a(this).addClass("ui-state-active"),c=this,a(document).one("mouseup",function(){c=null})}).bind("mouseup.button",function(){if(h.disabled)return!1;a(this).removeClass("ui-state-active")}).bind("keydown.button",function(b){if(h.disabled)return!1;(b.keyCode==a.ui.keyCode.SPACE||b.keyCode==a.ui.keyCode.ENTER)&&a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(b){b.keyCode===a.ui.keyCode.SPACE&&a(this).click()})),this._setOption("disabled",h.disabled),this._resetButton()},_determineButtonType:function(){this.element.is(":checkbox")?this.type="checkbox":this.element.is(":radio")?this.type="radio":this.element.is("input")?this.type="input":this.type="button";if(this.type==="checkbox"||this.type==="radio"){var a=this.element.parents().filter(":last"),b="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(b),this.buttonElement.length||(a=a.length?a.siblings():this.element.siblings(),this.buttonElement=a.filter(b),this.buttonElement.length||(this.buttonElement=a.find(b))),this.element.addClass("ui-helper-hidden-accessible");var c=this.element.is(":checked");c&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.attr("aria-pressed",c)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(g+" "+h+" "+i).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title"),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);if(b==="disabled"){c?this.element.propAttr("disabled",!0):this.element.propAttr("disabled",!1);return}this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b),this.type==="radio"?k(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):this.type==="checkbox"&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if(this.type==="input"){this.options.label&&this.element.val(this.options.label);return}var b=this.buttonElement.removeClass(i),c=a("<span></span>",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>"),d.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>"),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "))}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this)}})})(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28
34
+ * https://github.com/jquery/jquery-ui
35
  * Includes: jquery.ui.tabs.js
36
  * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
37
  (function(a,b){function e(){return++c}function f(){return++d}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return e.selected=a,!1}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1)return this.blur(),!1;e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected"))return e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur(),!1;if(!f.length)return e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur(),!1}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){return typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']"))),a},destroy:function(){var b=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie),this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);return j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e])),this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();return d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1<this.anchors.length?1:-1)),c.disabled=a.map(a.grep(c.disabled,function(a,c){return a!=b}),function(a,c){return a>=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0])),this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)==-1)return;return this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;return a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))),this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;return this.anchors.eq(a).trigger(this.options.event+".tabs"),this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}return this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(a,b){return this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b),this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.24"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a<c.anchors.length?a:0)},a),b&&b.stopPropagation()}),f=c._unrotate||(c._unrotate=b?function(a){e()}:function(a){a.clientX&&c.rotate(null)});return a?(this.element.bind("tabsshow",e),this.anchors.bind(d.event+".tabs",f),e()):(clearTimeout(c.rotation),this.element.unbind("tabsshow",e),this.anchors.unbind(d.event+".tabs",f),delete this._rotate,delete this._unrotate),this}})})(jQuery);;
js/zetaprints/colorpicker/colorpicker.css ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ui-colorpicker,
2
+ .ui-dialog.ui-colorpicker {
3
+ width: auto;
4
+ white-space: nowrap;
5
+
6
+ -webkit-touch-callout: none;
7
+ -webkit-user-select: none;
8
+ -khtml-user-select: none;
9
+ -ms-user-select: none;
10
+ user-select: none;
11
+ }
12
+
13
+ .ui-colorpicker-inline {
14
+ position: static;
15
+ }
16
+
17
+ .ui-colorpicker-buttonset {
18
+ float: left;
19
+ margin-left: .4em;
20
+ }
21
+
22
+ .ui-colorpicker-buttonset .ui-button {
23
+ margin: .5em 0 .5em 0;
24
+ cursor: pointer;
25
+ }
26
+
27
+ .ui-colorpicker-buttonpane {
28
+ background-image: none;
29
+ margin: .7em 0 0 0;
30
+ padding: 0 .2em;
31
+ border-left: 0;
32
+ border-right: 0;
33
+ border-bottom: 0;
34
+ }
35
+
36
+ .ui-colorpicker-buttonpane button {
37
+ float: right;
38
+ margin: .5em .2em .4em;
39
+ cursor: pointer;
40
+ padding: .2em .6em .3em .6em;
41
+ width: auto;
42
+ overflow: visible;
43
+ }
44
+
45
+ .ui-colorpicker-buttonpane button.ui-colorpicker-current {
46
+ float: left;
47
+ }
48
+
49
+ .ui-colorpicker table {
50
+ width: 100%;
51
+ font-size: 100%; /* Reset browser table font-size */
52
+ margin: 0;
53
+ }
54
+
55
+ .ui-colorpicker table td {
56
+ vertical-align: top;
57
+ }
58
+
59
+ .ui-colorpicker-padding-left {
60
+ padding-left: 10px;
61
+ }
62
+ .ui-colorpicker-padding-top {
63
+ padding-top: 10px;
64
+ }
65
+
66
+ .ui-colorpicker-border {
67
+ border: 1px inset;
68
+ display: inline-block;
69
+ }
70
+
71
+ /* Bar & map */
72
+ .ui-colorpicker-map > *,
73
+ .ui-colorpicker-bar > * {
74
+ position: absolute;
75
+ cursor: crosshair;
76
+ }
77
+
78
+ .ui-colorpicker-map-pointer,
79
+ .ui-colorpicker-bar-pointer {
80
+ position: absolute;
81
+ left: 0;
82
+ }
83
+ /* Map */
84
+ .ui-colorpicker-map,
85
+ .ui-colorpicker-map > * {
86
+ display: block;
87
+ width: 256px;
88
+ height: 256px;
89
+ overflow: hidden;
90
+ }
91
+
92
+ .ui-colorpicker-map-layer-1,
93
+ .ui-colorpicker-map-layer-2 {
94
+ background: url(images/map.png) no-repeat;
95
+ }
96
+
97
+ .ui-colorpicker-map-128,
98
+ .ui-colorpicker-map-128 > * {
99
+ width: 128px;
100
+ height: 128px;
101
+ }
102
+
103
+ .ui-colorpicker-map-128 .ui-colorpicker-map-layer-1,
104
+ .ui-colorpicker-map-128 .ui-colorpicker-map-layer-2 {
105
+ background: url(images/128/map.png) no-repeat;
106
+ }
107
+
108
+ .ui-colorpicker-map-layer-alpha {
109
+ background: url(images/map-opacity.png);
110
+ }
111
+
112
+ .ui-colorpicker-map-pointer {
113
+ display: inline-block;
114
+ width: 15px;
115
+ height: 15px;
116
+ background: url(images/map-pointer.png) no-repeat;
117
+ }
118
+
119
+ /* Bar */
120
+ .ui-colorpicker-bar,
121
+ .ui-colorpicker-bar > * {
122
+ display: block;
123
+ width: 20px;
124
+ height: 256px;
125
+ overflow: hidden;
126
+ background-repeat: repeat-x;
127
+ }
128
+
129
+ .ui-colorpicker-bar-128,
130
+ .ui-colorpicker-bar-128 > * {
131
+ height: 128px;
132
+ }
133
+
134
+ .ui-colorpicker-bar-layer-1,
135
+ .ui-colorpicker-bar-layer-2,
136
+ .ui-colorpicker-bar-layer-3,
137
+ .ui-colorpicker-bar-layer-4 {
138
+ background: url(images/bar.png) repeat-x;
139
+ }
140
+
141
+ .ui-colorpicker-bar-128 .ui-colorpicker-bar-layer-1,
142
+ .ui-colorpicker-bar-128 .ui-colorpicker-bar-layer-2,
143
+ .ui-colorpicker-bar-128 .ui-colorpicker-bar-layer-3,
144
+ .ui-colorpicker-bar-128 .ui-colorpicker-bar-layer-4 {
145
+ background: url(images/128/bar.png) repeat-x;
146
+ }
147
+
148
+ .ui-colorpicker-bar-layer-alpha {
149
+ background: url(images/bar-opacity.png);
150
+ }
151
+
152
+ .ui-colorpicker-bar-layer-alphabar {
153
+ background: url(images/bar-alpha.png);
154
+ }
155
+
156
+ .ui-colorpicker-bar-128 .ui-colorpicker-bar-layer-alphabar {
157
+ background: url(images/128/bar-alpha.png);
158
+ }
159
+
160
+ .ui-colorpicker-bar-pointer {
161
+ display: inline-block;
162
+ width: 20px;
163
+ height: 7px;
164
+ background: url(images/bar-pointer.png) no-repeat;
165
+ }
166
+
167
+ /* Preview */
168
+ .ui-colorpicker-preview {
169
+ text-align: center;
170
+ height: 20px;
171
+ }
172
+
173
+ .ui-colorpicker-preview-initial {
174
+ cursor: pointer;
175
+ }
176
+
177
+ .ui-colorpicker-preview-initial,
178
+ .ui-colorpicker-preview-current {
179
+ width: 50px;
180
+ height: 20px;
181
+ display: inline-block;
182
+ }
183
+
184
+ .ui-colorpicker-preview-initial-alpha,
185
+ .ui-colorpicker-preview-current-alpha {
186
+ width: 50px;
187
+ height: 20px;
188
+ display: inline-block;
189
+ background: url(images/preview-opacity.png) repeat;
190
+ }
191
+
192
+ /* Inputs */
193
+ .ui-colorpicker-rgb label,
194
+ .ui-colorpicker-hsv label,
195
+ .ui-colorpicker-hsl label,
196
+ .ui-colorpicker-lab label,
197
+ .ui-colorpicker-cmyk label,
198
+ .ui-colorpicker-alpha label {
199
+ width: 1.5em;
200
+ display: inline-block;
201
+ }
202
+
203
+ .ui-colorpicker-number {
204
+ margin: .1em;
205
+ width: 4em;
206
+ }
207
+
208
+ /* Hex */
209
+ .ui-colorpicker-hex {
210
+ text-align: center;
211
+ }
212
+
213
+ /* Swatches */
214
+ .ui-colorpicker-swatches {
215
+ height: 256px;
216
+ overflow: auto;
217
+ background-color: #f8f8f8;
218
+ }
219
+
220
+ .ui-colorpicker-swatch {
221
+ cursor: pointer;
222
+ float: left;
223
+ width: 11px;
224
+ height: 11px;
225
+ border-right: 1px solid black;
226
+ border-bottom: 1px solid black;
227
+ }
js/zetaprints/colorpicker/colorpicker.js ADDED
@@ -0,0 +1,2752 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jslint devel: true, bitwise: true, regexp: true, browser: true, confusion: true, unparam: true, eqeq: true, white: true, nomen: true, plusplus: true, maxerr: 50, indent: 4 */
2
+ /*globals jQuery,Color */
3
+
4
+ /*!
5
+ * ColorPicker
6
+ *
7
+ * Copyright (c) 2011-2013 Martijn W. van der Lee
8
+ * Licensed under the MIT.
9
+ */
10
+ /* Full-featured colorpicker for jQueryUI with full theming support.
11
+ * Most images from jPicker by Christopher T. Tillman.
12
+ * Sourcecode created from scratch by Martijn W. van der Lee.
13
+ */
14
+
15
+ //ZP-CHANGE:1 Cancel button should be always enabled
16
+ //ZP-ADDITION:1 Ignore subsequent calls for already closed dialog
17
+
18
+ ;(function ($) {
19
+ "use strict";
20
+
21
+ var _colorpicker_index = 0,
22
+
23
+ _container_popup = '<div class="ui-colorpicker ui-colorpicker-dialog ui-dialog ui-widget ui-widget-content ui-corner-all" style="display: none;"></div>',
24
+ _container_inlineFrame = '<div class="ui-colorpicker ui-colorpicker-inline ui-dialog ui-widget ui-widget-content ui-corner-all"></div>',
25
+ _container_inline = '<div class="ui-colorpicker ui-colorpicker-inline"></div>',
26
+
27
+ _intToHex = function (dec) {
28
+ var result = Math.floor(dec).toString(16);
29
+ if (result.length === 1) {
30
+ result = ('0' + result);
31
+ }
32
+ return result.toLowerCase();
33
+ },
34
+
35
+ _parseHex = function(color) {
36
+ var c,
37
+ m;
38
+
39
+ // {#}rrggbb
40
+ m = /^#?([a-fA-F0-9]{1,6})$/.exec(color);
41
+ if (m) {
42
+ c = parseInt(m[1], 16);
43
+ return new $.colorpicker.Color(
44
+ ((c >> 16) & 0xFF) / 255,
45
+ ((c >> 8) & 0xFF) / 255,
46
+ (c & 0xFF) / 255
47
+ );
48
+ }
49
+
50
+ return new $.colorpicker.Color();
51
+ },
52
+
53
+ _layoutTable = function(layout, callback) {
54
+ var bitmap,
55
+ x, y,
56
+ width, height,
57
+ columns, rows,
58
+ index,
59
+ cell,
60
+ html,
61
+ w, h,
62
+ colspan,
63
+ walked;
64
+
65
+ layout.sort(function(a, b) {
66
+ if (a.pos[1] === b.pos[1]) {
67
+ return a.pos[0] - b.pos[0];
68
+ }
69
+ return a.pos[1] - b.pos[1];
70
+ });
71
+
72
+ // Determine dimensions of the table
73
+ width = 0;
74
+ height = 0;
75
+ $.each (layout, function(index, part) {
76
+ width = Math.max(width, part.pos[0] + part.pos[2]);
77
+ height = Math.max(height, part.pos[1] + part.pos[3]);
78
+ });
79
+
80
+ // Initialize bitmap
81
+ bitmap = [];
82
+ for (x = 0; x < width; ++x) {
83
+ bitmap.push([]);
84
+ }
85
+
86
+ // Mark rows and columns which have layout assigned
87
+ rows = [];
88
+ columns = [];
89
+ $.each(layout, function(index, part) {
90
+ // mark columns
91
+ for (x = 0; x < part.pos[2]; x += 1) {
92
+ columns[part.pos[0] + x] = true;
93
+ }
94
+ for (y = 0; y < part.pos[3]; y += 1) {
95
+ rows[part.pos[1] + y] = true;
96
+ }
97
+ });
98
+
99
+ // Generate the table
100
+ html = '';
101
+ cell = layout[index = 0];
102
+ for (y = 0; y < height; ++y) {
103
+ html += '<tr>';
104
+ x = 0;
105
+ while (x < width) {
106
+ if (typeof cell !== 'undefined' && x === cell.pos[0] && y === cell.pos[1]) {
107
+ // Create a "real" cell
108
+ html += callback(cell, x, y);
109
+
110
+ for (h = 0; h < cell.pos[3]; h +=1) {
111
+ for (w = 0; w < cell.pos[2]; w +=1) {
112
+ bitmap[x + w][y + h] = true;
113
+ }
114
+ }
115
+
116
+ x += cell.pos[2];
117
+ cell = layout[++index];
118
+ } else {
119
+ // Fill in the gaps
120
+ colspan = 0;
121
+ walked = false;
122
+
123
+ while (x < width && bitmap[x][y] === undefined && (cell === undefined || y < cell.pos[1] || (y === cell.pos[1] && x < cell.pos[0]))) {
124
+ if (columns[x] === true) {
125
+ colspan += 1;
126
+ }
127
+ walked = true;
128
+ x += 1;
129
+ }
130
+
131
+ if (colspan > 0) {
132
+ html += '<td colspan="'+colspan+'"></td>';
133
+ } else if (!walked) {
134
+ x += 1;
135
+ }
136
+ }
137
+ }
138
+ html += '</tr>';
139
+ }
140
+
141
+ return '<table cellspacing="0" cellpadding="0" border="0"><tbody>' + html + '</tbody></table>';
142
+ };
143
+
144
+ $.colorpicker = new function() {
145
+ this.regional = {
146
+ '': {
147
+ ok: 'OK',
148
+ cancel: 'Cancel',
149
+ none: 'None',
150
+ button: 'Color',
151
+ title: 'Pick a color',
152
+ transparent: 'Transparent',
153
+ hsvH: 'H',
154
+ hsvS: 'S',
155
+ hsvV: 'V',
156
+ rgbR: 'R',
157
+ rgbG: 'G',
158
+ rgbB: 'B',
159
+ labL: 'L',
160
+ labA: 'a',
161
+ labB: 'b',
162
+ hslH: 'H',
163
+ hslS: 'S',
164
+ hslL: 'L',
165
+ cmykC: 'C',
166
+ cmykM: 'M',
167
+ cmykY: 'Y',
168
+ cmykK: 'K',
169
+ alphaA: 'A'
170
+ }
171
+ };
172
+
173
+ this.swatches = {
174
+ 'html': [
175
+ {name: 'black', r: 0, g: 0, b: 0},
176
+ {name: 'dimgray', r: 0.4117647058823529, g: 0.4117647058823529, b: 0.4117647058823529},
177
+ {name: 'gray', r: 0.5019607843137255, g: 0.5019607843137255, b: 0.5019607843137255},
178
+ {name: 'darkgray', r: 0.6627450980392157, g: 0.6627450980392157, b: 0.6627450980392157},
179
+ {name: 'silver', r: 0.7529411764705882, g: 0.7529411764705882, b: 0.7529411764705882},
180
+ {name: 'lightgrey', r: 0.8274509803921568, g: 0.8274509803921568, b: 0.8274509803921568},
181
+ {name: 'gainsboro', r: 0.8627450980392157, g: 0.8627450980392157, b: 0.8627450980392157},
182
+ {name: 'whitesmoke', r: 0.9607843137254902, g: 0.9607843137254902, b: 0.9607843137254902},
183
+ {name: 'white', r: 1, g: 1, b: 1},
184
+ {name: 'rosybrown', r: 0.7372549019607844, g: 0.5607843137254902, b: 0.5607843137254902},
185
+ {name: 'indianred', r: 0.803921568627451, g: 0.3607843137254902, b: 0.3607843137254902},
186
+ {name: 'brown', r: 0.6470588235294118, g: 0.16470588235294117, b: 0.16470588235294117},
187
+ {name: 'firebrick', r: 0.6980392156862745, g: 0.13333333333333333, b: 0.13333333333333333},
188
+ {name: 'lightcoral', r: 0.9411764705882353, g: 0.5019607843137255, b: 0.5019607843137255},
189
+ {name: 'maroon', r: 0.5019607843137255, g: 0, b: 0},
190
+ {name: 'darkred', r: 0.5450980392156862, g: 0, b: 0},
191
+ {name: 'red', r: 1, g: 0, b: 0},
192
+ {name: 'snow', r: 1, g: 0.9803921568627451, b: 0.9803921568627451},
193
+ {name: 'salmon', r: 0.9803921568627451, g: 0.5019607843137255, b: 0.4470588235294118},
194
+ {name: 'mistyrose', r: 1, g: 0.8941176470588236, b: 0.8823529411764706},
195
+ {name: 'tomato', r: 1, g: 0.38823529411764707, b: 0.2784313725490196},
196
+ {name: 'darksalmon', r: 0.9137254901960784, g: 0.5882352941176471, b: 0.47843137254901963},
197
+ {name: 'orangered', r: 1, g: 0.27058823529411763, b: 0},
198
+ {name: 'coral', r: 1, g: 0.4980392156862745, b: 0.3137254901960784},
199
+ {name: 'lightsalmon', r: 1, g: 0.6274509803921569, b: 0.47843137254901963},
200
+ {name: 'sienna', r: 0.6274509803921569, g: 0.3215686274509804, b: 0.17647058823529413},
201
+ {name: 'seashell', r: 1, g: 0.9607843137254902, b: 0.9333333333333333},
202
+ {name: 'chocolate', r: 0.8235294117647058, g: 0.4117647058823529, b: 0.11764705882352941},
203
+ {name: 'saddlebrown', r: 0.5450980392156862, g: 0.27058823529411763, b: 0.07450980392156863},
204
+ {name: 'sandybrown', r: 0.9568627450980393, g: 0.6431372549019608, b: 0.3764705882352941},
205
+ {name: 'peachpuff', r: 1, g: 0.8549019607843137, b: 0.7254901960784313},
206
+ {name: 'peru', r: 0.803921568627451, g: 0.5215686274509804, b: 0.24705882352941178},
207
+ {name: 'linen', r: 0.9803921568627451, g: 0.9411764705882353, b: 0.9019607843137255},
208
+ {name: 'darkorange', r: 1, g: 0.5490196078431373, b: 0},
209
+ {name: 'bisque', r: 1, g: 0.8941176470588236, b: 0.7686274509803922},
210
+ {name: 'burlywood', r: 0.8705882352941177, g: 0.7215686274509804, b: 0.5294117647058824},
211
+ {name: 'tan', r: 0.8235294117647058, g: 0.7058823529411765, b: 0.5490196078431373},
212
+ {name: 'antiquewhite', r: 0.9803921568627451, g: 0.9215686274509803, b: 0.8431372549019608},
213
+ {name: 'navajowhite', r: 1, g: 0.8705882352941177, b: 0.6784313725490196},
214
+ {name: 'blanchedalmond', r: 1, g: 0.9215686274509803, b: 0.803921568627451},
215
+ {name: 'papayawhip', r: 1, g: 0.9372549019607843, b: 0.8352941176470589},
216
+ {name: 'orange', r: 1, g: 0.6470588235294118, b: 0},
217
+ {name: 'moccasin', r: 1, g: 0.8941176470588236, b: 0.7098039215686275},
218
+ {name: 'wheat', r: 0.9607843137254902, g: 0.8705882352941177, b: 0.7019607843137254},
219
+ {name: 'oldlace', r: 0.9921568627450981, g: 0.9607843137254902, b: 0.9019607843137255},
220
+ {name: 'floralwhite', r: 1, g: 0.9803921568627451, b: 0.9411764705882353},
221
+ {name: 'goldenrod', r: 0.8549019607843137, g: 0.6470588235294118, b: 0.12549019607843137},
222
+ {name: 'darkgoldenrod', r: 0.7215686274509804, g: 0.5254901960784314, b: 0.043137254901960784},
223
+ {name: 'cornsilk', r: 1, g: 0.9725490196078431, b: 0.8627450980392157},
224
+ {name: 'gold', r: 1, g: 0.8431372549019608, b: 0},
225
+ {name: 'palegoldenrod', r: 0.9333333333333333, g: 0.9098039215686274, b: 0.6666666666666666},
226
+ {name: 'khaki', r: 0.9411764705882353, g: 0.9019607843137255, b: 0.5490196078431373},
227
+ {name: 'lemonchiffon', r: 1, g: 0.9803921568627451, b: 0.803921568627451},
228
+ {name: 'darkkhaki', r: 0.7411764705882353, g: 0.7176470588235294, b: 0.4196078431372549},
229
+ {name: 'beige', r: 0.9607843137254902, g: 0.9607843137254902, b: 0.8627450980392157},
230
+ {name: 'lightgoldenrodyellow', r: 0.9803921568627451, g: 0.9803921568627451, b: 0.8235294117647058},
231
+ {name: 'olive', r: 0.5019607843137255, g: 0.5019607843137255, b: 0},
232
+ {name: 'yellow', r: 1, g: 1, b: 0},
233
+ {name: 'lightyellow', r: 1, g: 1, b: 0.8784313725490196},
234
+ {name: 'ivory', r: 1, g: 1, b: 0.9411764705882353},
235
+ {name: 'olivedrab', r: 0.4196078431372549, g: 0.5568627450980392, b: 0.13725490196078433},
236
+ {name: 'yellowgreen', r: 0.6039215686274509, g: 0.803921568627451, b: 0.19607843137254902},
237
+ {name: 'darkolivegreen', r: 0.3333333333333333, g: 0.4196078431372549, b: 0.1843137254901961},
238
+ {name: 'greenyellow', r: 0.6784313725490196, g: 1, b: 0.1843137254901961},
239
+ {name: 'lawngreen', r: 0.48627450980392156, g: 0.9882352941176471, b: 0},
240
+ {name: 'chartreuse', r: 0.4980392156862745, g: 1, b: 0},
241
+ {name: 'darkseagreen', r: 0.5607843137254902, g: 0.7372549019607844, b: 0.5607843137254902},
242
+ {name: 'forestgreen', r: 0.13333333333333333, g: 0.5450980392156862, b: 0.13333333333333333},
243
+ {name: 'limegreen', r: 0.19607843137254902, g: 0.803921568627451, b: 0.19607843137254902},
244
+ {name: 'lightgreen', r: 0.5647058823529412, g: 0.9333333333333333, b: 0.5647058823529412},
245
+ {name: 'palegreen', r: 0.596078431372549, g: 0.984313725490196, b: 0.596078431372549},
246
+ {name: 'darkgreen', r: 0, g: 0.39215686274509803, b: 0},
247
+ {name: 'green', r: 0, g: 0.5019607843137255, b: 0},
248
+ {name: 'lime', r: 0, g: 1, b: 0},
249
+ {name: 'honeydew', r: 0.9411764705882353, g: 1, b: 0.9411764705882353},
250
+ {name: 'mediumseagreen', r: 0.23529411764705882, g: 0.7019607843137254, b: 0.44313725490196076},
251
+ {name: 'seagreen', r: 0.1803921568627451, g: 0.5450980392156862, b: 0.3411764705882353},
252
+ {name: 'springgreen', r: 0, g: 1, b: 0.4980392156862745},
253
+ {name: 'mintcream', r: 0.9607843137254902, g: 1, b: 0.9803921568627451},
254
+ {name: 'mediumspringgreen', r: 0, g: 0.9803921568627451, b: 0.6039215686274509},
255
+ {name: 'mediumaquamarine', r: 0.4, g: 0.803921568627451, b: 0.6666666666666666},
256
+ {name: 'aquamarine', r: 0.4980392156862745, g: 1, b: 0.8313725490196079},
257
+ {name: 'turquoise', r: 0.25098039215686274, g: 0.8784313725490196, b: 0.8156862745098039},
258
+ {name: 'lightseagreen', r: 0.12549019607843137, g: 0.6980392156862745, b: 0.6666666666666666},
259
+ {name: 'mediumturquoise', r: 0.2823529411764706, g: 0.8196078431372549, b: 0.8},
260
+ {name: 'darkslategray', r: 0.1843137254901961, g: 0.30980392156862746, b: 0.30980392156862746},
261
+ {name: 'paleturquoise', r: 0.6862745098039216, g: 0.9333333333333333, b: 0.9333333333333333},
262
+ {name: 'teal', r: 0, g: 0.5019607843137255, b: 0.5019607843137255},
263
+ {name: 'darkcyan', r: 0, g: 0.5450980392156862, b: 0.5450980392156862},
264
+ {name: 'darkturquoise', r: 0, g: 0.807843137254902, b: 0.8196078431372549},
265
+ {name: 'aqua', r: 0, g: 1, b: 1},
266
+ {name: 'cyan', r: 0, g: 1, b: 1},
267
+ {name: 'lightcyan', r: 0.8784313725490196, g: 1, b: 1},
268
+ {name: 'azure', r: 0.9411764705882353, g: 1, b: 1},
269
+ {name: 'cadetblue', r: 0.37254901960784315, g: 0.6196078431372549, b: 0.6274509803921569},
270
+ {name: 'powderblue', r: 0.6901960784313725, g: 0.8784313725490196, b: 0.9019607843137255},
271
+ {name: 'lightblue', r: 0.6784313725490196, g: 0.8470588235294118, b: 0.9019607843137255},
272
+ {name: 'deepskyblue', r: 0, g: 0.7490196078431373, b: 1},
273
+ {name: 'skyblue', r: 0.5294117647058824, g: 0.807843137254902, b: 0.9215686274509803},
274
+ {name: 'lightskyblue', r: 0.5294117647058824, g: 0.807843137254902, b: 0.9803921568627451},
275
+ {name: 'steelblue', r: 0.27450980392156865, g: 0.5098039215686274, b: 0.7058823529411765},
276
+ {name: 'aliceblue', r: 0.9411764705882353, g: 0.9725490196078431, b: 1},
277
+ {name: 'dodgerblue', r: 0.11764705882352941, g: 0.5647058823529412, b: 1},
278
+ {name: 'slategray', r: 0.4392156862745098, g: 0.5019607843137255, b: 0.5647058823529412},
279
+ {name: 'lightslategray', r: 0.4666666666666667, g: 0.5333333333333333, b: 0.6},
280
+ {name: 'lightsteelblue', r: 0.6901960784313725, g: 0.7686274509803922, b: 0.8705882352941177},
281
+ {name: 'cornflowerblue', r: 0.39215686274509803, g: 0.5843137254901961, b: 0.9294117647058824},
282
+ {name: 'royalblue', r: 0.2549019607843137, g: 0.4117647058823529, b: 0.8823529411764706},
283
+ {name: 'midnightblue', r: 0.09803921568627451, g: 0.09803921568627451, b: 0.4392156862745098},
284
+ {name: 'lavender', r: 0.9019607843137255, g: 0.9019607843137255, b: 0.9803921568627451},
285
+ {name: 'navy', r: 0, g: 0, b: 0.5019607843137255},
286
+ {name: 'darkblue', r: 0, g: 0, b: 0.5450980392156862},
287
+ {name: 'mediumblue', r: 0, g: 0, b: 0.803921568627451},
288
+ {name: 'blue', r: 0, g: 0, b: 1},
289
+ {name: 'ghostwhite', r: 0.9725490196078431, g: 0.9725490196078431, b: 1},
290
+ {name: 'darkslateblue', r: 0.2823529411764706, g: 0.23921568627450981, b: 0.5450980392156862},
291
+ {name: 'slateblue', r: 0.41568627450980394, g: 0.35294117647058826, b: 0.803921568627451},
292
+ {name: 'mediumslateblue', r: 0.4823529411764706, g: 0.40784313725490196, b: 0.9333333333333333},
293
+ {name: 'mediumpurple', r: 0.5764705882352941, g: 0.4392156862745098, b: 0.8588235294117647},
294
+ {name: 'blueviolet', r: 0.5411764705882353, g: 0.16862745098039217, b: 0.8862745098039215},
295
+ {name: 'indigo', r: 0.29411764705882354, g: 0, b: 0.5098039215686274},
296
+ {name: 'darkorchid', r: 0.6, g: 0.19607843137254902, b: 0.8},
297
+ {name: 'darkviolet', r: 0.5803921568627451, g: 0, b: 0.8274509803921568},
298
+ {name: 'mediumorchid', r: 0.7294117647058823, g: 0.3333333333333333, b: 0.8274509803921568},
299
+ {name: 'thistle', r: 0.8470588235294118, g: 0.7490196078431373, b: 0.8470588235294118},
300
+ {name: 'plum', r: 0.8666666666666667, g: 0.6274509803921569, b: 0.8666666666666667},
301
+ {name: 'violet', r: 0.9333333333333333, g: 0.5098039215686274, b: 0.9333333333333333},
302
+ {name: 'purple', r: 0.5019607843137255, g: 0, b: 0.5019607843137255},
303
+ {name: 'darkmagenta', r: 0.5450980392156862, g: 0, b: 0.5450980392156862},
304
+ {name: 'magenta', r: 1, g: 0, b: 1},
305
+ {name: 'fuchsia', r: 1, g: 0, b: 1},
306
+ {name: 'orchid', r: 0.8549019607843137, g: 0.4392156862745098, b: 0.8392156862745098},
307
+ {name: 'mediumvioletred', r: 0.7803921568627451, g: 0.08235294117647059, b: 0.5215686274509804},
308
+ {name: 'deeppink', r: 1, g: 0.0784313725490196, b: 0.5764705882352941},
309
+ {name: 'hotpink', r: 1, g: 0.4117647058823529, b: 0.7058823529411765},
310
+ {name: 'palevioletred', r: 0.8588235294117647, g: 0.4392156862745098, b: 0.5764705882352941},
311
+ {name: 'lavenderblush', r: 1, g: 0.9411764705882353, b: 0.9607843137254902},
312
+ {name: 'crimson', r: 0.8627450980392157, g: 0.0784313725490196, b: 0.23529411764705882},
313
+ {name: 'pink', r: 1, g: 0.7529411764705882, b: 0.796078431372549},
314
+ {name: 'lightpink', r: 1, g: 0.7137254901960784, b: 0.7568627450980392}
315
+ ]
316
+ };
317
+
318
+ this.writers = {
319
+ '#HEX': function(color, that) {
320
+ return that._formatColor('#rxgxbx', color);
321
+ }
322
+ , '#HEX3': function(color, that) {
323
+ var hex3 = $.colorpicker.writers.HEX3(color);
324
+ return hex3 === false? false : '#'+hex3;
325
+ }
326
+ , 'HEX': function(color, that) {
327
+ return that._formatColor('rxgxbx', color);
328
+ }
329
+ , 'HEX3': function(color, that) {
330
+ var rgb = color.getRGB(),
331
+ r = Math.floor(rgb.r * 255),
332
+ g = Math.floor(rgb.g * 255),
333
+ b = Math.floor(rgb.b * 255);
334
+
335
+ if (((r >>> 4) === (r &= 0xf))
336
+ && ((g >>> 4) === (g &= 0xf))
337
+ && ((b >>> 4) === (b &= 0xf))) {
338
+ return r.toString(16)+g.toString(16)+b.toString(16);
339
+ }
340
+ return false;
341
+ }
342
+ , 'RGB': function(color, that) {
343
+ return color.getAlpha() >= 1
344
+ ? that._formatColor('rgb(rd,gd,bd)', color)
345
+ : false;
346
+ }
347
+ , 'RGBA': function(color, that) {
348
+ return that._formatColor('rgba(rd,gd,bd,af)', color);
349
+ }
350
+ , 'RGB%': function(color, that) {
351
+ return color.getAlpha() >= 1
352
+ ? that._formatColor('rgb(rp%,gp%,bp%)', color)
353
+ : false;
354
+ }
355
+ , 'RGBA%': function(color, that) {
356
+ return that._formatColor('rgba(rp%,gp%,bp%,af)', color);
357
+ }
358
+ , 'HSL': function(color, that) {
359
+ return color.getAlpha() >= 1
360
+ ? that._formatColor('hsl(hd,sd,vd)', color)
361
+ : false;
362
+ }
363
+ , 'HSLA': function(color, that) {
364
+ return that._formatColor('hsla(hd,sd,vd,af)', color);
365
+ }
366
+ , 'HSL%': function(color, that) {
367
+ return color.getAlpha() >= 1
368
+ ? that._formatColor('hsl(hp%,sp%,vp%)', color)
369
+ : false;
370
+ }
371
+ , 'HSLA%': function(color, that) {
372
+ return that._formatColor('hsla(hp%,sp%,vp%,af)', color);
373
+ }
374
+ , 'NAME': function(color, that) {
375
+ return that._closestName(color);
376
+ }
377
+ , 'EXACT': function(color, that) { // @todo experimental. Implement a good fallback list
378
+ return that._exactName(color);
379
+ }
380
+ };
381
+
382
+ this.parsers = {
383
+ '': function(color) {
384
+ if (color === '') {
385
+ return new $.colorpicker.Color();
386
+ }
387
+ }
388
+ , 'NAME': function(color, that) {
389
+ var c = that._getSwatch($.trim(color));
390
+ if (c) {
391
+ return new $.colorpicker.Color(c.r, c.g, c.b);
392
+ }
393
+ }
394
+ , 'RGBA': function(color) {
395
+ var m = /^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)$/.exec(color);
396
+ if (m) {
397
+ return new $.colorpicker.Color(
398
+ m[1] / 255,
399
+ m[2] / 255,
400
+ m[3] / 255,
401
+ parseFloat(m[4])
402
+ );
403
+ }
404
+ }
405
+ , 'RGBA%': function(color) {
406
+ var m = /^rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)$/.exec(color);
407
+ if (m) {
408
+ return new $.colorpicker.Color(
409
+ m[1] / 100,
410
+ m[2] / 100,
411
+ m[3] / 100,
412
+ m[4] / 100
413
+ );
414
+ }
415
+ }
416
+ , 'HSLA': function(color) {
417
+ var m = /^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)$/.exec(color);
418
+ if (m) {
419
+ return (new $.colorpicker.Color()).setHSL(
420
+ m[1] / 255,
421
+ m[2] / 255,
422
+ m[3] / 255).setAlpha(parseFloat(m[4]));
423
+ }
424
+ }
425
+ , 'HSLA%': function(color) {
426
+ var m = /^hsla?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)$/.exec(color);
427
+ if (m) {
428
+ return (new $.colorpicker.Color()).setHSL(
429
+ m[1] / 100,
430
+ m[2] / 100,
431
+ m[3] / 100).setAlpha(m[4] / 100);
432
+ }
433
+ }
434
+ , '#HEX': function(color) {
435
+ var m = /^#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/.exec(color);
436
+ if (m) {
437
+ return new $.colorpicker.Color(
438
+ parseInt(m[1], 16) / 255,
439
+ parseInt(m[2], 16) / 255,
440
+ parseInt(m[3], 16) / 255
441
+ );
442
+ }
443
+ }
444
+ , '#HEX3': function(color) {
445
+ var m = /^#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])$/.exec(color);
446
+ if (m) {
447
+ return new $.colorpicker.Color(
448
+ parseInt(String(m[1]) + m[1], 16) / 255,
449
+ parseInt(String(m[2]) + m[2], 16) / 255,
450
+ parseInt(String(m[3]) + m[3], 16) / 255
451
+ );
452
+ }
453
+ }
454
+ , 'HEX': function(color) {
455
+ var m = /^([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/.exec(color);
456
+ if (m) {
457
+ return new $.colorpicker.Color(
458
+ parseInt(m[1], 16) / 255,
459
+ parseInt(m[2], 16) / 255,
460
+ parseInt(m[3], 16) / 255
461
+ );
462
+ }
463
+ }
464
+ , 'HEX3': function(color) {
465
+ var m = /^([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])$/.exec(color);
466
+ if (m) {
467
+ return new $.colorpicker.Color(
468
+ parseInt(String(m[1]) + m[1], 16) / 255,
469
+ parseInt(String(m[2]) + m[2], 16) / 255,
470
+ parseInt(String(m[3]) + m[3], 16) / 255
471
+ );
472
+ }
473
+ }
474
+ };
475
+
476
+ this.partslists = {
477
+ 'full': ['header', 'map', 'bar', 'hex', 'hsv', 'rgb', 'alpha', 'lab', 'cmyk', 'preview', 'swatches', 'footer'],
478
+ 'popup': ['map', 'bar', 'hex', 'hsv', 'rgb', 'alpha', 'preview', 'footer'],
479
+ 'draggable': ['header', 'map', 'bar', 'hex', 'hsv', 'rgb', 'alpha', 'preview', 'footer'],
480
+ 'inline': ['map', 'bar', 'hex', 'hsv', 'rgb', 'alpha', 'preview']
481
+ };
482
+
483
+ this.limits = {
484
+ 'websafe': function(color) {
485
+ color.limit(6);
486
+ },
487
+ 'nibble': function(color) {
488
+ color.limit(16);
489
+ },
490
+ 'binary': function(color) {
491
+ color.limit(2);
492
+ },
493
+ 'name': function(color, that) {
494
+ var swatch = that._getSwatch(that._closestName(color));
495
+ color.setRGB(swatch.r, swatch.g, swatch.b);
496
+ }
497
+ };
498
+
499
+ this.parts = {
500
+ header: function (inst) {
501
+ var that = this,
502
+ e = null,
503
+ _html =function() {
504
+ var title = inst.options.title || inst._getRegional('title'),
505
+ html = '<span class="ui-dialog-title">' + title + '</span>';
506
+
507
+ if (!inst.inline && inst.options.showCloseButton) {
508
+ html += '<a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button">'
509
+ + '<span class="ui-icon ui-icon-closethick">close</span></a>';
510
+ }
511
+
512
+ return '<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">' + html + '</div>';
513
+ };
514
+
515
+ this.init = function() {
516
+ e = $(_html()).prependTo(inst.dialog);
517
+
518
+ var close = $('.ui-dialog-titlebar-close', e);
519
+ inst._hoverable(close);
520
+ inst._focusable(close);
521
+ close.click(function(event) {
522
+ event.preventDefault();
523
+ inst.close(inst.options.revert);
524
+ });
525
+
526
+ if (!inst.inline && inst.options.draggable) {
527
+ var draggableOptions = {
528
+ handle: e,
529
+ }
530
+ if (inst.options.containment) {
531
+ draggableOptions.containment = inst.options.containment;
532
+ }
533
+ inst.dialog.draggable(draggableOptions);
534
+ }
535
+ };
536
+ },
537
+
538
+ map: function (inst) {
539
+ var that = this,
540
+ e = null,
541
+ mousemove_timeout = null,
542
+ _mousedown, _mouseup, _mousemove, _html;
543
+
544
+ _mousedown = function (event) {
545
+ if (!inst.opened) {
546
+ return;
547
+ }
548
+
549
+ var div = $('.ui-colorpicker-map-layer-pointer', e),
550
+ offset = div.offset(),
551
+ width = div.width(),
552
+ height = div.height(),
553
+ x = event.pageX - offset.left,
554
+ y = event.pageY - offset.top;
555
+
556
+ if (x >= 0 && x < width && y >= 0 && y < height) {
557
+ event.stopImmediatePropagation();
558
+ event.preventDefault();
559
+ e.unbind('mousedown', _mousedown);
560
+ $(document).bind('mouseup', _mouseup);
561
+ $(document).bind('mousemove', _mousemove);
562
+ _mousemove(event);
563
+ }
564
+ };
565
+
566
+ _mouseup = function (event) {
567
+ event.stopImmediatePropagation();
568
+ event.preventDefault();
569
+ $(document).unbind('mouseup', _mouseup);
570
+ $(document).unbind('mousemove', _mousemove);
571
+ e.bind('mousedown', _mousedown);
572
+ };
573
+
574
+ _mousemove = function (event) {
575
+ event.stopImmediatePropagation();
576
+ event.preventDefault();
577
+
578
+ if (event.pageX === that.x && event.pageY === that.y) {
579
+ return;
580
+ }
581
+ that.x = event.pageX;
582
+ that.y = event.pageY;
583
+
584
+ var div = $('.ui-colorpicker-map-layer-pointer', e),
585
+ offset = div.offset(),
586
+ width = div.width(),
587
+ height = div.height(),
588
+ x = event.pageX - offset.left,
589
+ y = event.pageY - offset.top;
590
+
591
+ x = Math.max(0, Math.min(x / width, 1));
592
+ y = Math.max(0, Math.min(y / height, 1));
593
+
594
+ // interpret values
595
+ switch (inst.mode) {
596
+ case 'h':
597
+ inst.color.setHSV(null, x, 1 - y);
598
+ break;
599
+
600
+ case 's':
601
+ case 'a':
602
+ inst.color.setHSV(x, null, 1 - y);
603
+ break;
604
+
605
+ case 'v':
606
+ inst.color.setHSV(x, 1 - y, null);
607
+ break;
608
+
609
+ case 'r':
610
+ inst.color.setRGB(null, 1 - y, x);
611
+ break;
612
+
613
+ case 'g':
614
+ inst.color.setRGB(1 - y, null, x);
615
+ break;
616
+
617
+ case 'b':
618
+ inst.color.setRGB(x, 1 - y, null);
619
+ break;
620
+ }
621
+
622
+ inst._change();
623
+ };
624
+
625
+ _html = function () {
626
+ var html = '<div class="ui-colorpicker-map ui-colorpicker-map-'+(inst.options.part.map.size || 256)+' ui-colorpicker-border">'
627
+ + '<span class="ui-colorpicker-map-layer-1">&nbsp;</span>'
628
+ + '<span class="ui-colorpicker-map-layer-2">&nbsp;</span>'
629
+ + (inst.options.alpha ? '<span class="ui-colorpicker-map-layer-alpha">&nbsp;</span>' : '')
630
+ + '<span class="ui-colorpicker-map-layer-pointer"><span class="ui-colorpicker-map-pointer"></span></span></div>';
631
+ return html;
632
+ };
633
+
634
+ this.update = function () {
635
+ var step = ((inst.options.part.map.size || 256) * 65 / 64);
636
+
637
+ switch (inst.mode) {
638
+ case 'h':
639
+ $('.ui-colorpicker-map-layer-1', e).css({'background-position': '0 0', 'opacity': ''}).show();
640
+ $('.ui-colorpicker-map-layer-2', e).hide();
641
+ break;
642
+
643
+ case 's':
644
+ case 'a':
645
+ $('.ui-colorpicker-map-layer-1', e).css({'background-position': '0 '+(-step)+'px', 'opacity': ''}).show();
646
+ $('.ui-colorpicker-map-layer-2', e).css({'background-position': '0 '+(-step*2)+'px', 'opacity': ''}).show();
647
+ break;
648
+
649
+ case 'v':
650
+ $(e).css('background-color', 'black');
651
+ $('.ui-colorpicker-map-layer-1', e).css({'background-position': '0 '+(-step*3)+'px', 'opacity': ''}).show();
652
+ $('.ui-colorpicker-map-layer-2', e).hide();
653
+ break;
654
+
655
+ case 'r':
656
+ $('.ui-colorpicker-map-layer-1', e).css({'background-position': '0 '+(-step*4)+'px', 'opacity': ''}).show();
657
+ $('.ui-colorpicker-map-layer-2', e).css({'background-position': '0 '+(-step*5)+'px', 'opacity': ''}).show();
658
+ break;
659
+
660
+ case 'g':
661
+ $('.ui-colorpicker-map-layer-1', e).css({'background-position': '0 '+(-step*6)+'px', 'opacity': ''}).show();
662
+ $('.ui-colorpicker-map-layer-2', e).css({'background-position': '0 '+(-step*7)+'px', 'opacity': ''}).show();
663
+ break;
664
+
665
+ case 'b':
666
+ $('.ui-colorpicker-map-layer-1', e).css({'background-position': '0 '+(-step*8)+'px', 'opacity': ''}).show();
667
+ $('.ui-colorpicker-map-layer-2', e).css({'background-position': '0 '+(-step*9)+'px', 'opacity': ''}).show();
668
+ break;
669
+ }
670
+ that.repaint();
671
+ };
672
+
673
+ this.repaint = function () {
674
+ var div = $('.ui-colorpicker-map-layer-pointer', e),
675
+ x = 0,
676
+ y = 0;
677
+
678
+ switch (inst.mode) {
679
+ case 'h':
680
+ x = inst.color.getHSV().s * div.width();
681
+ y = (1 - inst.color.getHSV().v) * div.width();
682
+ $(e).css('background-color', inst.color.copy().setHSV(null, 1, 1).toCSS());
683
+ break;
684
+
685
+ case 's':
686
+ case 'a':
687
+ x = inst.color.getHSV().h * div.width();
688
+ y = (1 - inst.color.getHSV().v) * div.width();
689
+ $('.ui-colorpicker-map-layer-2', e).css('opacity', 1 - inst.color.getHSV().s);
690
+ break;
691
+
692
+ case 'v':
693
+ x = inst.color.getHSV().h * div.width();
694
+ y = (1 - inst.color.getHSV().s) * div.width();
695
+ $('.ui-colorpicker-map-layer-1', e).css('opacity', inst.color.getHSV().v);
696
+ break;
697
+
698
+ case 'r':
699
+ x = inst.color.getRGB().b * div.width();
700
+ y = (1 - inst.color.getRGB().g) * div.width();
701
+ $('.ui-colorpicker-map-layer-2', e).css('opacity', inst.color.getRGB().r);
702
+ break;
703
+
704
+ case 'g':
705
+ x = inst.color.getRGB().b * div.width();
706
+ y = (1 - inst.color.getRGB().r) * div.width();
707
+ $('.ui-colorpicker-map-layer-2', e).css('opacity', inst.color.getRGB().g);
708
+ break;
709
+
710
+ case 'b':
711
+ x = inst.color.getRGB().r * div.width();
712
+ y = (1 - inst.color.getRGB().g) * div.width();
713
+ $('.ui-colorpicker-map-layer-2', e).css('opacity', inst.color.getRGB().b);
714
+ break;
715
+ }
716
+
717
+ if (inst.options.alpha) {
718
+ $('.ui-colorpicker-map-layer-alpha', e).css('opacity', 1 - inst.color.getAlpha());
719
+ }
720
+
721
+ $('.ui-colorpicker-map-pointer', e).css({
722
+ 'left': x - 7,
723
+ 'top': y - 7
724
+ });
725
+ };
726
+
727
+ this.init = function () {
728
+ e = $(_html()).appendTo($('.ui-colorpicker-map-container', inst.dialog));
729
+
730
+ e.bind('mousedown', _mousedown);
731
+ };
732
+ },
733
+
734
+ bar: function (inst) {
735
+ var that = this,
736
+ e = null,
737
+ _mousedown, _mouseup, _mousemove, _html;
738
+
739
+ _mousedown = function (event) {
740
+ if (!inst.opened) {
741
+ return;
742
+ }
743
+
744
+ var div = $('.ui-colorpicker-bar-layer-pointer', e),
745
+ offset = div.offset(),
746
+ width = div.width(),
747
+ height = div.height(),
748
+ x = event.pageX - offset.left,
749
+ y = event.pageY - offset.top;
750
+
751
+ if (x >= 0 && x < width && y >= 0 && y < height) {
752
+ event.stopImmediatePropagation();
753
+ event.preventDefault();
754
+ e.unbind('mousedown', _mousedown);
755
+ $(document).bind('mouseup', _mouseup);
756
+ $(document).bind('mousemove', _mousemove);
757
+ _mousemove(event);
758
+ }
759
+ };
760
+
761
+ _mouseup = function (event) {
762
+ event.stopImmediatePropagation();
763
+ event.preventDefault();
764
+ $(document).unbind('mouseup', _mouseup);
765
+ $(document).unbind('mousemove', _mousemove);
766
+ e.bind('mousedown', _mousedown);
767
+ };
768
+
769
+ _mousemove = function (event) {
770
+ event.stopImmediatePropagation();
771
+ event.preventDefault();
772
+
773
+ if (event.pageY === that.y) {
774
+ return;
775
+ }
776
+ that.y = event.pageY;
777
+
778
+ var div = $('.ui-colorpicker-bar-layer-pointer', e),
779
+ offset = div.offset(),
780
+ height = div.height(),
781
+ y = event.pageY - offset.top;
782
+
783
+ y = Math.max(0, Math.min(y / height, 1));
784
+
785
+ // interpret values
786
+ switch (inst.mode) {
787
+ case 'h':
788
+ inst.color.setHSV(1 - y, null, null);
789
+ break;
790
+
791
+ case 's':
792
+ inst.color.setHSV(null, 1 - y, null);
793
+ break;
794
+
795
+ case 'v':
796
+ inst.color.setHSV(null, null, 1 - y);
797
+ break;
798
+
799
+ case 'r':
800
+ inst.color.setRGB(1 - y, null, null);
801
+ break;
802
+
803
+ case 'g':
804
+ inst.color.setRGB(null, 1 - y, null);
805
+ break;
806
+
807
+ case 'b':
808
+ inst.color.setRGB(null, null, 1 - y);
809
+ break;
810
+
811
+ case 'a':
812
+ inst.color.setAlpha(1 - y);
813
+ break;
814
+ }
815
+
816
+ inst._change();
817
+ };
818
+
819
+ _html = function () {
820
+ var html = '<div class="ui-colorpicker-bar ui-colorpicker-bar-'+(inst.options.part.bar.size || 256)+' ui-colorpicker-border">'
821
+ + '<span class="ui-colorpicker-bar-layer-1">&nbsp;</span>'
822
+ + '<span class="ui-colorpicker-bar-layer-2">&nbsp;</span>'
823
+ + '<span class="ui-colorpicker-bar-layer-3">&nbsp;</span>'
824
+ + '<span class="ui-colorpicker-bar-layer-4">&nbsp;</span>';
825
+
826
+ if (inst.options.alpha) {
827
+ html += '<span class="ui-colorpicker-bar-layer-alpha">&nbsp;</span>'
828
+ + '<span class="ui-colorpicker-bar-layer-alphabar">&nbsp;</span>';
829
+ }
830
+
831
+ html += '<span class="ui-colorpicker-bar-layer-pointer"><span class="ui-colorpicker-bar-pointer"></span></span></div>';
832
+
833
+ return html;
834
+ };
835
+
836
+ this.update = function () {
837
+ var step = ((inst.options.part.bar.size || 256) * 65 / 64);
838
+
839
+ switch (inst.mode) {
840
+ case 'h':
841
+ case 's':
842
+ case 'v':
843
+ case 'r':
844
+ case 'g':
845
+ case 'b':
846
+ $('.ui-colorpicker-bar-layer-alpha', e).show();
847
+ $('.ui-colorpicker-bar-layer-alphabar', e).hide();
848
+ break;
849
+
850
+ case 'a':
851
+ $('.ui-colorpicker-bar-layer-alpha', e).hide();
852
+ $('.ui-colorpicker-bar-layer-alphabar', e).show();
853
+ break;
854
+ }
855
+
856
+ switch (inst.mode) {
857
+ case 'h':
858
+ $('.ui-colorpicker-bar-layer-1', e).css({'background-position': '0 0', 'opacity': ''}).show();
859
+ $('.ui-colorpicker-bar-layer-2', e).hide();
860
+ $('.ui-colorpicker-bar-layer-3', e).hide();
861
+ $('.ui-colorpicker-bar-layer-4', e).hide();
862
+ break;
863
+
864
+ case 's':
865
+ $('.ui-colorpicker-bar-layer-1', e).css({'background-position': '0 '+(-step)+'px', 'opacity': ''}).show();
866
+ $('.ui-colorpicker-bar-layer-2', e).css({'background-position': '0 '+(-step*2)+'px', 'opacity': ''}).show();
867
+ $('.ui-colorpicker-bar-layer-3', e).hide();
868
+ $('.ui-colorpicker-bar-layer-4', e).hide();
869
+ break;
870
+
871
+ case 'v':
872
+ $('.ui-colorpicker-bar-layer-1', e).css({'background-position': '0 '+(-step*2)+'px', 'opacity': ''}).show();
873
+ $('.ui-colorpicker-bar-layer-2', e).hide();
874
+ $('.ui-colorpicker-bar-layer-3', e).hide();
875
+ $('.ui-colorpicker-bar-layer-4', e).hide();
876
+ break;
877
+
878
+ case 'r':
879
+ $('.ui-colorpicker-bar-layer-1', e).css({'background-position': '0 '+(-step*6)+'px', 'opacity': ''}).show();
880
+ $('.ui-colorpicker-bar-layer-2', e).css({'background-position': '0 '+(-step*5)+'px', 'opacity': ''}).show();
881
+ $('.ui-colorpicker-bar-layer-3', e).css({'background-position': '0 '+(-step*3)+'px', 'opacity': ''}).show();
882
+ $('.ui-colorpicker-bar-layer-4', e).css({'background-position': '0 '+(-step*4)+'px', 'opacity': ''}).show();
883
+ break;
884
+
885
+ case 'g':
886
+ $('.ui-colorpicker-bar-layer-1', e).css({'background-position': '0 '+(-step*10)+'px', 'opacity': ''}).show();
887
+ $('.ui-colorpicker-bar-layer-2', e).css({'background-position': '0 '+(-step*9)+'px', 'opacity': ''}).show();
888
+ $('.ui-colorpicker-bar-layer-3', e).css({'background-position': '0 '+(-step*7)+'px', 'opacity': ''}).show();
889
+ $('.ui-colorpicker-bar-layer-4', e).css({'background-position': '0 '+(-step*8)+'px', 'opacity': ''}).show();
890
+ break;
891
+
892
+ case 'b':
893
+ $('.ui-colorpicker-bar-layer-1', e).css({'background-position': '0 '+(-step*14)+'px', 'opacity': ''}).show();
894
+ $('.ui-colorpicker-bar-layer-2', e).css({'background-position': '0 '+(-step*13)+'px', 'opacity': ''}).show();
895
+ $('.ui-colorpicker-bar-layer-3', e).css({'background-position': '0 '+(-step*11)+'px', 'opacity': ''}).show();
896
+ $('.ui-colorpicker-bar-layer-4', e).css({'background-position': '0 '+(-step*12)+'px', 'opacity': ''}).show();
897
+ break;
898
+
899
+ case 'a':
900
+ $('.ui-colorpicker-bar-layer-1', e).hide();
901
+ $('.ui-colorpicker-bar-layer-2', e).hide();
902
+ $('.ui-colorpicker-bar-layer-3', e).hide();
903
+ $('.ui-colorpicker-bar-layer-4', e).hide();
904
+ break;
905
+ }
906
+ that.repaint();
907
+ };
908
+
909
+ this.repaint = function () {
910
+ var div = $('.ui-colorpicker-bar-layer-pointer', e),
911
+ y = 0;
912
+
913
+ switch (inst.mode) {
914
+ case 'h':
915
+ y = (1 - inst.color.getHSV().h) * div.height();
916
+ break;
917
+
918
+ case 's':
919
+ y = (1 - inst.color.getHSV().s) * div.height();
920
+ $('.ui-colorpicker-bar-layer-2', e).css('opacity', 1 - inst.color.getHSV().v);
921
+ $(e).css('background-color', inst.color.copy().setHSV(null, 1, null).toCSS());
922
+ break;
923
+
924
+ case 'v':
925
+ y = (1 - inst.color.getHSV().v) * div.height();
926
+ $(e).css('background-color', inst.color.copy().setHSV(null, null, 1).toCSS());
927
+ break;
928
+
929
+ case 'r':
930
+ y = (1 - inst.color.getRGB().r) * div.height();
931
+ $('.ui-colorpicker-bar-layer-2', e).css('opacity', Math.max(0, (inst.color.getRGB().b - inst.color.getRGB().g)));
932
+ $('.ui-colorpicker-bar-layer-3', e).css('opacity', Math.max(0, (inst.color.getRGB().g - inst.color.getRGB().b)));
933
+ $('.ui-colorpicker-bar-layer-4', e).css('opacity', Math.min(inst.color.getRGB().b, inst.color.getRGB().g));
934
+ break;
935
+
936
+ case 'g':
937
+ y = (1 - inst.color.getRGB().g) * div.height();
938
+ $('.ui-colorpicker-bar-layer-2', e).css('opacity', Math.max(0, (inst.color.getRGB().b - inst.color.getRGB().r)));
939
+ $('.ui-colorpicker-bar-layer-3', e).css('opacity', Math.max(0, (inst.color.getRGB().r - inst.color.getRGB().b)));
940
+ $('.ui-colorpicker-bar-layer-4', e).css('opacity', Math.min(inst.color.getRGB().r, inst.color.getRGB().b));
941
+ break;
942
+
943
+ case 'b':
944
+ y = (1 - inst.color.getRGB().b) * div.height();
945
+ $('.ui-colorpicker-bar-layer-2', e).css('opacity', Math.max(0, (inst.color.getRGB().r - inst.color.getRGB().g)));
946
+ $('.ui-colorpicker-bar-layer-3', e).css('opacity', Math.max(0, (inst.color.getRGB().g - inst.color.getRGB().r)));
947
+ $('.ui-colorpicker-bar-layer-4', e).css('opacity', Math.min(inst.color.getRGB().r, inst.color.getRGB().g));
948
+ break;
949
+
950
+ case 'a':
951
+ y = (1 - inst.color.getAlpha()) * div.height();
952
+ $(e).css('background-color', inst.color.copy().toCSS());
953
+ break;
954
+ }
955
+
956
+ if (inst.mode !== 'a') {
957
+ $('.ui-colorpicker-bar-layer-alpha', e).css('opacity', 1 - inst.color.getAlpha());
958
+ }
959
+
960
+ $('.ui-colorpicker-bar-pointer', e).css('top', y - 3);
961
+ };
962
+
963
+ this.init = function () {
964
+ e = $(_html()).appendTo($('.ui-colorpicker-bar-container', inst.dialog));
965
+
966
+ e.bind('mousedown', _mousedown);
967
+ };
968
+ },
969
+
970
+ preview: function (inst) {
971
+ var that = this,
972
+ e = null,
973
+ _html;
974
+
975
+ _html = function () {
976
+ return '<div class="ui-colorpicker-preview ui-colorpicker-border">'
977
+ + '<div class="ui-colorpicker-preview-initial"><div class="ui-colorpicker-preview-initial-alpha"></div></div>'
978
+ + '<div class="ui-colorpicker-preview-current"><div class="ui-colorpicker-preview-current-alpha"></div></div>'
979
+ + '</div>';
980
+ };
981
+
982
+ this.init = function () {
983
+ e = $(_html()).appendTo($('.ui-colorpicker-preview-container', inst.dialog));
984
+
985
+ $('.ui-colorpicker-preview-initial', e).click(function () {
986
+ inst.color = inst.currentColor.copy();
987
+ inst._change();
988
+ });
989
+ };
990
+
991
+ this.update = function () {
992
+ if (inst.options.alpha) {
993
+ $('.ui-colorpicker-preview-initial-alpha, .ui-colorpicker-preview-current-alpha', e).show();
994
+ } else {
995
+ $('.ui-colorpicker-preview-initial-alpha, .ui-colorpicker-preview-current-alpha', e).hide();
996
+ }
997
+
998
+ this.repaint();
999
+ };
1000
+
1001
+ this.repaint = function () {
1002
+ $('.ui-colorpicker-preview-initial', e).css('background-color', inst.currentColor.set ? inst.currentColor.toCSS() : '').attr('title', inst.currentColor.set ? inst.currentColor.toCSS() : '');
1003
+ $('.ui-colorpicker-preview-initial-alpha', e).css('opacity', 1 - inst.currentColor.getAlpha());
1004
+ $('.ui-colorpicker-preview-current', e).css('background-color', inst.color.set ? inst.color.toCSS() : '').attr('title', inst.color.set ? inst.color.toCSS() : '');
1005
+ $('.ui-colorpicker-preview-current-alpha', e).css('opacity', 1 - inst.color.getAlpha());
1006
+ };
1007
+ },
1008
+
1009
+ hsv: function (inst) {
1010
+ var that = this,
1011
+ e = null,
1012
+ _html;
1013
+
1014
+ _html = function () {
1015
+ var html = '';
1016
+
1017
+ if (inst.options.hsv) {
1018
+ html += '<div class="ui-colorpicker-hsv-h"><input class="ui-colorpicker-mode" type="radio" value="h"/><label>' + inst._getRegional('hsvH') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="360" size="10"/><span class="ui-colorpicker-unit">&deg;</span></div>'
1019
+ + '<div class="ui-colorpicker-hsv-s"><input class="ui-colorpicker-mode" type="radio" value="s"/><label>' + inst._getRegional('hsvS') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="100" size="10"/><span class="ui-colorpicker-unit">%</span></div>'
1020
+ + '<div class="ui-colorpicker-hsv-v"><input class="ui-colorpicker-mode" type="radio" value="v"/><label>' + inst._getRegional('hsvV') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="100" size="10"/><span class="ui-colorpicker-unit">%</span></div>';
1021
+ }
1022
+
1023
+ return '<div class="ui-colorpicker-hsv">' + html + '</div>';
1024
+ };
1025
+
1026
+ this.init = function () {
1027
+ e = $(_html()).appendTo($('.ui-colorpicker-hsv-container', inst.dialog));
1028
+
1029
+ $('.ui-colorpicker-mode', e).click(function () {
1030
+ inst.mode = $(this).val();
1031
+ inst._updateAllParts();
1032
+ });
1033
+
1034
+ $('.ui-colorpicker-number', e).bind('change keyup', function () {
1035
+ inst.color.setHSV(
1036
+ $('.ui-colorpicker-hsv-h .ui-colorpicker-number', e).val() / 360,
1037
+ $('.ui-colorpicker-hsv-s .ui-colorpicker-number', e).val() / 100,
1038
+ $('.ui-colorpicker-hsv-v .ui-colorpicker-number', e).val() / 100
1039
+ );
1040
+ inst._change();
1041
+ });
1042
+ };
1043
+
1044
+ this.repaint = function () {
1045
+ var hsv = inst.color.getHSV();
1046
+ hsv.h *= 360;
1047
+ hsv.s *= 100;
1048
+ hsv.v *= 100;
1049
+
1050
+ $.each(hsv, function (index, value) {
1051
+ var input = $('.ui-colorpicker-hsv-' + index + ' .ui-colorpicker-number', e);
1052
+ value = Math.round(value);
1053
+ if (parseInt(input.val(), 10) !== value) {
1054
+ input.val(value);
1055
+ }
1056
+ });
1057
+ };
1058
+
1059
+ this.update = function () {
1060
+ $('.ui-colorpicker-mode', e).each(function () {
1061
+ $(this).attr('checked', $(this).val() === inst.mode);
1062
+ });
1063
+ this.repaint();
1064
+ };
1065
+ },
1066
+
1067
+ rgb: function (inst) {
1068
+ var that = this,
1069
+ e = null,
1070
+ _html;
1071
+
1072
+ _html = function () {
1073
+ var html = '';
1074
+
1075
+ if (inst.options.rgb) {
1076
+ html += '<div class="ui-colorpicker-rgb-r"><input class="ui-colorpicker-mode" type="radio" value="r"/><label>' + inst._getRegional('rgbR') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="255"/></div>'
1077
+ + '<div class="ui-colorpicker-rgb-g"><input class="ui-colorpicker-mode" type="radio" value="g"/><label>' + inst._getRegional('rgbG') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="255"/></div>'
1078
+ + '<div class="ui-colorpicker-rgb-b"><input class="ui-colorpicker-mode" type="radio" value="b"/><label>' + inst._getRegional('rgbB') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="255"/></div>';
1079
+ }
1080
+
1081
+ return '<div class="ui-colorpicker-rgb">' + html + '</div>';
1082
+ };
1083
+
1084
+ this.init = function () {
1085
+ e = $(_html()).appendTo($('.ui-colorpicker-rgb-container', inst.dialog));
1086
+
1087
+ $('.ui-colorpicker-mode', e).click(function () {
1088
+ inst.mode = $(this).val();
1089
+ inst._updateAllParts();
1090
+ });
1091
+
1092
+ $('.ui-colorpicker-number', e).bind('change keyup', function () {
1093
+ var r = $('.ui-colorpicker-rgb-r .ui-colorpicker-number', e).val();
1094
+ inst.color.setRGB(
1095
+ $('.ui-colorpicker-rgb-r .ui-colorpicker-number', e).val() / 255,
1096
+ $('.ui-colorpicker-rgb-g .ui-colorpicker-number', e).val() / 255,
1097
+ $('.ui-colorpicker-rgb-b .ui-colorpicker-number', e).val() / 255
1098
+ );
1099
+
1100
+ inst._change();
1101
+ });
1102
+ };
1103
+
1104
+ this.repaint = function () {
1105
+ $.each(inst.color.getRGB(), function (index, value) {
1106
+ var input = $('.ui-colorpicker-rgb-' + index + ' .ui-colorpicker-number', e);
1107
+ value = Math.floor(value * 255);
1108
+ if (parseInt(input.val(), 10) !== value) {
1109
+ input.val(value);
1110
+ }
1111
+ });
1112
+ };
1113
+
1114
+ this.update = function () {
1115
+ $('.ui-colorpicker-mode', e).each(function () {
1116
+ $(this).attr('checked', $(this).val() === inst.mode);
1117
+ });
1118
+ this.repaint();
1119
+ };
1120
+ },
1121
+
1122
+ lab: function (inst) {
1123
+ var that = this,
1124
+ part = null,
1125
+ html = function () {
1126
+ var html = '';
1127
+
1128
+ if (inst.options.hsv) {
1129
+ html += '<div class="ui-colorpicker-lab-l"><label>' + inst._getRegional('labL') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/></div>'
1130
+ + '<div class="ui-colorpicker-lab-a"><label>' + inst._getRegional('labA') + '</label><input class="ui-colorpicker-number" type="number" min="-128" max="127"/></div>'
1131
+ + '<div class="ui-colorpicker-lab-b"><label>' + inst._getRegional('labB') + '</label><input class="ui-colorpicker-number" type="number" min="-128" max="127"/></div>';
1132
+ }
1133
+
1134
+ return '<div class="ui-colorpicker-lab">' + html + '</div>';
1135
+ };
1136
+
1137
+ this.init = function () {
1138
+ var data = 0;
1139
+
1140
+ part = $(html()).appendTo($('.ui-colorpicker-lab-container', inst.dialog));
1141
+
1142
+ $('.ui-colorpicker-number', part).bind('change keyup', function (event) {
1143
+ inst.color.setLAB(
1144
+ parseInt($('.ui-colorpicker-lab-l .ui-colorpicker-number', part).val(), 10) / 100,
1145
+ (parseInt($('.ui-colorpicker-lab-a .ui-colorpicker-number', part).val(), 10) + 128) / 255,
1146
+ (parseInt($('.ui-colorpicker-lab-b .ui-colorpicker-number', part).val(), 10) + 128) / 255
1147
+ );
1148
+ inst._change();
1149
+ });
1150
+ };
1151
+
1152
+ this.repaint = function () {
1153
+ var lab = inst.color.getLAB();
1154
+ lab.l *= 100;
1155
+ lab.a = (lab.a * 255) - 128;
1156
+ lab.b = (lab.b * 255) - 128;
1157
+
1158
+ $.each(lab, function (index, value) {
1159
+ var input = $('.ui-colorpicker-lab-' + index + ' .ui-colorpicker-number', part);
1160
+ value = Math.round(value);
1161
+ if (parseInt(input.val(), 10) !== value) {
1162
+ input.val(value);
1163
+ }
1164
+ });
1165
+ };
1166
+
1167
+ this.update = function () {
1168
+ this.repaint();
1169
+ };
1170
+ },
1171
+
1172
+ cmyk: function (inst) {
1173
+ var that = this,
1174
+ part = null,
1175
+ html = function () {
1176
+ var html = '';
1177
+
1178
+ if (inst.options.hsv) {
1179
+ html += '<div class="ui-colorpicker-cmyk-c"><label>' + inst._getRegional('cmykC') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/><span class="ui-colorpicker-unit">%</span></div>'
1180
+ + '<div class="ui-colorpicker-cmyk-m"><label>' + inst._getRegional('cmykM') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/><span class="ui-colorpicker-unit">%</span></div>'
1181
+ + '<div class="ui-colorpicker-cmyk-y"><label>' + inst._getRegional('cmykY') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/><span class="ui-colorpicker-unit">%</span></div>'
1182
+ + '<div class="ui-colorpicker-cmyk-k"><label>' + inst._getRegional('cmykK') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/><span class="ui-colorpicker-unit">%</span></div>';
1183
+ }
1184
+
1185
+ return '<div class="ui-colorpicker-cmyk">' + html + '</div>';
1186
+ };
1187
+
1188
+ this.init = function () {
1189
+ part = $(html()).appendTo($('.ui-colorpicker-cmyk-container', inst.dialog));
1190
+
1191
+ $('.ui-colorpicker-number', part).bind('change keyup', function (event) {
1192
+ inst.color.setCMYK(
1193
+ parseInt($('.ui-colorpicker-cmyk-c .ui-colorpicker-number', part).val(), 10) / 100,
1194
+ parseInt($('.ui-colorpicker-cmyk-m .ui-colorpicker-number', part).val(), 10) / 100,
1195
+ parseInt($('.ui-colorpicker-cmyk-y .ui-colorpicker-number', part).val(), 10) / 100,
1196
+ parseInt($('.ui-colorpicker-cmyk-k .ui-colorpicker-number', part).val(), 10) / 100
1197
+ );
1198
+ inst._change();
1199
+ });
1200
+ };
1201
+
1202
+ this.repaint = function () {
1203
+ $.each(inst.color.getCMYK(), function (index, value) {
1204
+ var input = $('.ui-colorpicker-cmyk-' + index + ' .ui-colorpicker-number', part);
1205
+ value = Math.round(value * 100);
1206
+ if (parseInt(input.val(), 10, 10) !== value) {
1207
+ input.val(value);
1208
+ }
1209
+ });
1210
+ };
1211
+
1212
+ this.update = function () {
1213
+ this.repaint();
1214
+ };
1215
+ },
1216
+
1217
+ alpha: function (inst) {
1218
+ var that = this,
1219
+ e = null,
1220
+ _html;
1221
+
1222
+ _html = function () {
1223
+ var html = '';
1224
+
1225
+ if (inst.options.alpha) {
1226
+ html += '<div class="ui-colorpicker-a"><input class="ui-colorpicker-mode" name="mode" type="radio" value="a"/><label>' + inst._getRegional('alphaA') + '</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/><span class="ui-colorpicker-unit">%</span></div>';
1227
+ }
1228
+
1229
+ return '<div class="ui-colorpicker-alpha">' + html + '</div>';
1230
+ };
1231
+
1232
+ this.init = function () {
1233
+ e = $(_html()).appendTo($('.ui-colorpicker-alpha-container', inst.dialog));
1234
+
1235
+ $('.ui-colorpicker-mode', e).click(function () {
1236
+ inst.mode = $(this).val();
1237
+ inst._updateAllParts();
1238
+ });
1239
+
1240
+ $('.ui-colorpicker-number', e).bind('change keyup', function () {
1241
+ inst.color.setAlpha($('.ui-colorpicker-a .ui-colorpicker-number', e).val() / 100);
1242
+ inst._change();
1243
+ });
1244
+ };
1245
+
1246
+ this.update = function () {
1247
+ $('.ui-colorpicker-mode', e).each(function () {
1248
+ $(this).attr('checked', $(this).val() === inst.mode);
1249
+ });
1250
+ this.repaint();
1251
+ };
1252
+
1253
+ this.repaint = function () {
1254
+ var input = $('.ui-colorpicker-a .ui-colorpicker-number', e),
1255
+ value = Math.round(inst.color.getAlpha() * 100);
1256
+ if (parseInt(input.val(), 10) !== value) {
1257
+ input.val(value);
1258
+ }
1259
+ };
1260
+ },
1261
+
1262
+ hex: function (inst) {
1263
+ var that = this,
1264
+ e = null,
1265
+ _html;
1266
+
1267
+ _html = function () {
1268
+ var html = '';
1269
+
1270
+ if (inst.options.alpha) {
1271
+ html += '<input class="ui-colorpicker-hex-alpha" type="text" maxlength="2" size="2"/>';
1272
+ }
1273
+
1274
+ html += '<input class="ui-colorpicker-hex-input" type="text" maxlength="6" size="6"/>';
1275
+
1276
+ return '<div class="ui-colorpicker-hex"><label>#</label>' + html + '</div>';
1277
+ };
1278
+
1279
+ this.init = function () {
1280
+ e = $(_html()).appendTo($('.ui-colorpicker-hex-container', inst.dialog));
1281
+
1282
+ // repeat here makes the invalid input disappear faster
1283
+ $('.ui-colorpicker-hex-input', e).bind('change keydown keyup', function (a, b, c) {
1284
+ if (/[^a-fA-F0-9]/.test($(this).val())) {
1285
+ $(this).val($(this).val().replace(/[^a-fA-F0-9]/, ''));
1286
+ }
1287
+ });
1288
+
1289
+ $('.ui-colorpicker-hex-input', e).bind('change keyup', function () {
1290
+ // repeat here makes sure that the invalid input doesn't get parsed
1291
+ inst.color = _parseHex($(this).val()).setAlpha(inst.color.getAlpha());
1292
+ inst._change();
1293
+ });
1294
+
1295
+ $('.ui-colorpicker-hex-alpha', e).bind('change keydown keyup', function () {
1296
+ if (/[^a-fA-F0-9]/.test($(this).val())) {
1297
+ $(this).val($(this).val().replace(/[^a-fA-F0-9]/, ''));
1298
+ }
1299
+ });
1300
+
1301
+ $('.ui-colorpicker-hex-alpha', e).bind('change keyup', function () {
1302
+ inst.color.setAlpha(parseInt($('.ui-colorpicker-hex-alpha', e).val(), 16) / 255);
1303
+ inst._change();
1304
+ });
1305
+ };
1306
+
1307
+ this.update = function () {
1308
+ this.repaint();
1309
+ };
1310
+
1311
+ this.repaint = function () {
1312
+ if (!$('.ui-colorpicker-hex-input', e).is(':focus')) {
1313
+ $('.ui-colorpicker-hex-input', e).val(inst.color.toHex(true));
1314
+ }
1315
+
1316
+ if (!$('.ui-colorpicker-hex-alpha', e).is(':focus')) {
1317
+ $('.ui-colorpicker-hex-alpha', e).val(_intToHex(inst.color.getAlpha() * 255));
1318
+ }
1319
+ };
1320
+ },
1321
+
1322
+ swatches: function (inst) {
1323
+ var that = this,
1324
+ part = null,
1325
+ html = function () {
1326
+ var html = '';
1327
+
1328
+ inst._eachSwatch(function (name, color) {
1329
+ var c = new $.colorpicker.Color(color.r, color.g, color.b),
1330
+ css = c.toCSS();
1331
+ html += '<div class="ui-colorpicker-swatch" style="background-color:' + css + '" title="' + name + '"></div>';
1332
+ });
1333
+
1334
+ return '<div class="ui-colorpicker-swatches ui-colorpicker-border" style="width:' + inst.options.swatchesWidth + 'px">' + html + '</div>';
1335
+ };
1336
+
1337
+ this.init = function () {
1338
+ part = $(html()).appendTo($('.ui-colorpicker-swatches-container', inst.dialog));
1339
+
1340
+ $('.ui-colorpicker-swatch', part).click(function () {
1341
+ inst.color = inst._parseColor($(this).css('background-color'));
1342
+ inst._change();
1343
+ });
1344
+ };
1345
+ },
1346
+
1347
+ footer: function (inst) {
1348
+ var that = this,
1349
+ part = null,
1350
+ id_transparent = 'ui-colorpicker-special-transparent-'+_colorpicker_index,
1351
+ id_none = 'ui-colorpicker-special-none-'+_colorpicker_index,
1352
+ html = function () {
1353
+ var html = '';
1354
+
1355
+ if (inst.options.alpha || (!inst.inline && inst.options.showNoneButton)) {
1356
+ html += '<div class="ui-colorpicker-buttonset">';
1357
+
1358
+ if (inst.options.alpha) {
1359
+ html += '<input type="radio" name="ui-colorpicker-special" id="'+id_transparent+'" class="ui-colorpicker-special-transparent"/><label for="'+id_transparent+'">' + inst._getRegional('transparent') + '</label>';
1360
+ }
1361
+ if (!inst.inline && inst.options.showNoneButton) {
1362
+ html += '<input type="radio" name="ui-colorpicker-special" id="'+id_none+'" class="ui-colorpicker-special-none"><label for="'+id_none+'">' + inst._getRegional('none') + '</label>';
1363
+ }
1364
+ html += '</div>';
1365
+ }
1366
+
1367
+ if (!inst.inline) {
1368
+ html += '<div class="ui-dialog-buttonset">';
1369
+ if (inst.options.showCancelButton) {
1370
+ html += '<button class="ui-colorpicker-cancel">' + inst._getRegional('cancel') + '</button>';
1371
+ }
1372
+ html += '<button class="ui-colorpicker-ok">' + inst._getRegional('ok') + '</button>';
1373
+ html += '</div>';
1374
+ }
1375
+
1376
+ return '<div class="ui-dialog-buttonpane ui-widget-content">' + html + '</div>';
1377
+ };
1378
+
1379
+ this.init = function () {
1380
+ part = $(html()).appendTo(inst.dialog);
1381
+
1382
+ $('.ui-colorpicker-ok', part).button().click(function () {
1383
+ inst.close();
1384
+ });
1385
+
1386
+ $('.ui-colorpicker-cancel', part).button().click(function () {
1387
+ inst.close(true); //cancel
1388
+ });
1389
+
1390
+ //inst._getRegional('transparent')
1391
+ $('.ui-colorpicker-buttonset', part).buttonset();
1392
+
1393
+ $('.ui-colorpicker-special-color', part).click(function () {
1394
+ inst._change();
1395
+ });
1396
+
1397
+ $('#'+id_none, part).click(function () {
1398
+ inst.color.set = false;
1399
+ inst._change();
1400
+ });
1401
+
1402
+ $('#'+id_transparent, part).click(function () {
1403
+ inst.color.setAlpha(0);
1404
+ inst._change();
1405
+ });
1406
+ };
1407
+
1408
+ this.repaint = function () {
1409
+ if (!inst.color.set) {
1410
+ $('.ui-colorpicker-special-none', part).attr('checked', true).button( "refresh" );
1411
+ } else if (inst.color.getAlpha() === 0) {
1412
+ $('.ui-colorpicker-special-transparent', part).attr('checked', true).button( "refresh" );
1413
+ } else {
1414
+ $('input', part).attr('checked', false).button( "refresh" );
1415
+ }
1416
+
1417
+ //ZP-CHANGE:1 Cancel button should be always enabled
1418
+ //$('.ui-colorpicker-cancel', part).button(inst.changed ? 'enable' : 'disable');
1419
+ };
1420
+
1421
+ this.update = function () {};
1422
+ }
1423
+ };
1424
+
1425
+ this.Color = function () {
1426
+ var spaces = { rgb: {r: 0, g: 0, b: 0},
1427
+ hsv: {h: 0, s: 0, v: 0},
1428
+ hsl: {h: 0, s: 0, l: 0},
1429
+ lab: {l: 0, a: 0, b: 0},
1430
+ cmyk: {c: 0, m: 0, y: 0, k: 1}
1431
+ },
1432
+ a = 1,
1433
+ illuminant = [0.9504285, 1, 1.0889], // CIE-L*ab D65/2' 1931
1434
+ args = arguments,
1435
+ _clip = function(v) {
1436
+ if (isNaN(v) || v === null) {
1437
+ return 0;
1438
+ }
1439
+ if (typeof v == 'string') {
1440
+ v = parseInt(v, 10);
1441
+ }
1442
+ return Math.max(0, Math.min(v, 1));
1443
+ },
1444
+ _hexify = function (number) {
1445
+ var digits = '0123456789abcdef',
1446
+ lsd = number % 16,
1447
+ msd = (number - lsd) / 16,
1448
+ hexified = digits.charAt(msd) + digits.charAt(lsd);
1449
+ return hexified;
1450
+ },
1451
+ _rgb_to_xyz = function(rgb) {
1452
+ var r = (rgb.r > 0.04045) ? Math.pow((rgb.r + 0.055) / 1.055, 2.4) : rgb.r / 12.92,
1453
+ g = (rgb.g > 0.04045) ? Math.pow((rgb.g + 0.055) / 1.055, 2.4) : rgb.g / 12.92,
1454
+ b = (rgb.b > 0.04045) ? Math.pow((rgb.b + 0.055) / 1.055, 2.4) : rgb.b / 12.92;
1455
+
1456
+ return {
1457
+ x: r * 0.4124 + g * 0.3576 + b * 0.1805,
1458
+ y: r * 0.2126 + g * 0.7152 + b * 0.0722,
1459
+ z: r * 0.0193 + g * 0.1192 + b * 0.9505
1460
+ };
1461
+ },
1462
+ _xyz_to_rgb = function(xyz) {
1463
+ var rgb = {
1464
+ r: xyz.x * 3.2406 + xyz.y * -1.5372 + xyz.z * -0.4986,
1465
+ g: xyz.x * -0.9689 + xyz.y * 1.8758 + xyz.z * 0.0415,
1466
+ b: xyz.x * 0.0557 + xyz.y * -0.2040 + xyz.z * 1.0570
1467
+ };
1468
+
1469
+ rgb.r = (rgb.r > 0.0031308) ? 1.055 * Math.pow(rgb.r, (1 / 2.4)) - 0.055 : 12.92 * rgb.r;
1470
+ rgb.g = (rgb.g > 0.0031308) ? 1.055 * Math.pow(rgb.g, (1 / 2.4)) - 0.055 : 12.92 * rgb.g;
1471
+ rgb.b = (rgb.b > 0.0031308) ? 1.055 * Math.pow(rgb.b, (1 / 2.4)) - 0.055 : 12.92 * rgb.b;
1472
+
1473
+ return rgb;
1474
+ },
1475
+ _rgb_to_hsv = function(rgb) {
1476
+ var minVal = Math.min(rgb.r, rgb.g, rgb.b),
1477
+ maxVal = Math.max(rgb.r, rgb.g, rgb.b),
1478
+ delta = maxVal - minVal,
1479
+ del_R, del_G, del_B,
1480
+ hsv = {
1481
+ h: 0,
1482
+ s: 0,
1483
+ v: maxVal
1484
+ };
1485
+
1486
+ if (delta === 0) {
1487
+ hsv.h = 0;
1488
+ hsv.s = 0;
1489
+ } else {
1490
+ hsv.s = delta / maxVal;
1491
+
1492
+ del_R = (((maxVal - rgb.r) / 6) + (delta / 2)) / delta;
1493
+ del_G = (((maxVal - rgb.g) / 6) + (delta / 2)) / delta;
1494
+ del_B = (((maxVal - rgb.b) / 6) + (delta / 2)) / delta;
1495
+
1496
+ if (rgb.r === maxVal) {
1497
+ hsv.h = del_B - del_G;
1498
+ } else if (rgb.g === maxVal) {
1499
+ hsv.h = (1 / 3) + del_R - del_B;
1500
+ } else if (rgb.b === maxVal) {
1501
+ hsv.h = (2 / 3) + del_G - del_R;
1502
+ }
1503
+
1504
+ if (hsv.h < 0) {
1505
+ hsv.h += 1;
1506
+ } else if (hsv.h > 1) {
1507
+ hsv.h -= 1;
1508
+ }
1509
+ }
1510
+
1511
+ return hsv;
1512
+ },
1513
+ _hsv_to_rgb = function(hsv) {
1514
+ var rgb = {
1515
+ r: 0,
1516
+ g: 0,
1517
+ b: 0
1518
+ },
1519
+ var_h,
1520
+ var_i,
1521
+ var_1,
1522
+ var_2,
1523
+ var_3;
1524
+
1525
+ if (hsv.s === 0) {
1526
+ rgb.r = rgb.g = rgb.b = hsv.v;
1527
+ } else {
1528
+ var_h = hsv.h === 1 ? 0 : hsv.h * 6;
1529
+ var_i = Math.floor(var_h);
1530
+ var_1 = hsv.v * (1 - hsv.s);
1531
+ var_2 = hsv.v * (1 - hsv.s * (var_h - var_i));
1532
+ var_3 = hsv.v * (1 - hsv.s * (1 - (var_h - var_i)));
1533
+
1534
+ if (var_i === 0) {
1535
+ rgb.r = hsv.v;
1536
+ rgb.g = var_3;
1537
+ rgb.b = var_1;
1538
+ } else if (var_i === 1) {
1539
+ rgb.r = var_2;
1540
+ rgb.g = hsv.v;
1541
+ rgb.b = var_1;
1542
+ } else if (var_i === 2) {
1543
+ rgb.r = var_1;
1544
+ rgb.g = hsv.v;
1545
+ rgb.b = var_3;
1546
+ } else if (var_i === 3) {
1547
+ rgb.r = var_1;
1548
+ rgb.g = var_2;
1549
+ rgb.b = hsv.v;
1550
+ } else if (var_i === 4) {
1551
+ rgb.r = var_3;
1552
+ rgb.g = var_1;
1553
+ rgb.b = hsv.v;
1554
+ } else {
1555
+ rgb.r = hsv.v;
1556
+ rgb.g = var_1;
1557
+ rgb.b = var_2;
1558
+ }
1559
+ }
1560
+
1561
+ return rgb;
1562
+ },
1563
+ _rgb_to_hsl = function(rgb) {
1564
+ var minVal = Math.min(rgb.r, rgb.g, rgb.b),
1565
+ maxVal = Math.max(rgb.r, rgb.g, rgb.b),
1566
+ delta = maxVal - minVal,
1567
+ del_R, del_G, del_B,
1568
+ hsl = {
1569
+ h: 0,
1570
+ s: 0,
1571
+ l: (maxVal + minVal) / 2
1572
+ };
1573
+
1574
+ if (delta === 0) {
1575
+ hsl.h = 0;
1576
+ hsl.s = 0;
1577
+ } else {
1578
+ hsl.s = hsl.l < 0.5 ? delta / (maxVal + minVal) : delta / (2 - maxVal - minVal);
1579
+
1580
+ del_R = (((maxVal - rgb.r) / 6) + (delta / 2)) / delta;
1581
+ del_G = (((maxVal - rgb.g) / 6) + (delta / 2)) / delta;
1582
+ del_B = (((maxVal - rgb.b) / 6) + (delta / 2)) / delta;
1583
+
1584
+ if (rgb.r === maxVal) {
1585
+ hsl.h = del_B - del_G;
1586
+ } else if (rgb.g === maxVal) {
1587
+ hsl.h = (1 / 3) + del_R - del_B;
1588
+ } else if (rgb.b === maxVal) {
1589
+ hsl.h = (2 / 3) + del_G - del_R;
1590
+ }
1591
+
1592
+ if (hsl.h < 0) {
1593
+ hsl.h += 1;
1594
+ } else if (hsl.h > 1) {
1595
+ hsl.h -= 1;
1596
+ }
1597
+ }
1598
+
1599
+ return hsl;
1600
+ },
1601
+ _hsl_to_rgb = function(hsl) {
1602
+ var var_1,
1603
+ var_2,
1604
+ hue_to_rgb = function(v1, v2, vH) {
1605
+ if (vH < 0) {
1606
+ vH += 1;
1607
+ }
1608
+ if (vH > 1) {
1609
+ vH -= 1;
1610
+ }
1611
+ if ((6 * vH) < 1) {
1612
+ return v1 + (v2 - v1) * 6 * vH;
1613
+ }
1614
+ if ((2 * vH) < 1) {
1615
+ return v2;
1616
+ }
1617
+ if ((3 * vH) < 2) {
1618
+ return v1 + (v2 - v1) * ((2 / 3) - vH) * 6;
1619
+ }
1620
+ return v1;
1621
+ };
1622
+
1623
+ if (hsl.s === 0) {
1624
+ return {
1625
+ r: hsl.l,
1626
+ g: hsl.l,
1627
+ b: hsl.l
1628
+ };
1629
+ }
1630
+
1631
+ var_2 = (hsl.l < 0.5) ? hsl.l * (1 + hsl.s) : (hsl.l + hsl.s) - (hsl.s * hsl.l);
1632
+ var_1 = 2 * hsl.l - var_2;
1633
+
1634
+ return {
1635
+ r: hue_to_rgb(var_1, var_2, hsl.h + (1 / 3)),
1636
+ g: hue_to_rgb(var_1, var_2, hsl.h),
1637
+ b: hue_to_rgb(var_1, var_2, hsl.h - (1 / 3))
1638
+ };
1639
+ },
1640
+ _xyz_to_lab = function(xyz) {
1641
+ var x = xyz.x / illuminant[0],
1642
+ y = xyz.y / illuminant[1],
1643
+ z = xyz.z / illuminant[2];
1644
+
1645
+ x = (x > 0.008856) ? Math.pow(x, (1/3)) : (7.787 * x) + (16/116);
1646
+ y = (y > 0.008856) ? Math.pow(y, (1/3)) : (7.787 * y) + (16/116);
1647
+ z = (z > 0.008856) ? Math.pow(z, (1/3)) : (7.787 * z) + (16/116);
1648
+
1649
+ return {
1650
+ l: ((116 * y) - 16) / 100, // [0,100]
1651
+ a: ((500 * (x - y)) + 128) / 255, // [-128,127]
1652
+ b: ((200 * (y - z)) + 128) / 255 // [-128,127]
1653
+ };
1654
+ },
1655
+ _lab_to_xyz = function(lab) {
1656
+ var lab2 = {
1657
+ l: lab.l * 100,
1658
+ a: (lab.a * 255) - 128,
1659
+ b: (lab.b * 255) - 128
1660
+ },
1661
+ xyz = {
1662
+ x: 0,
1663
+ y: (lab2.l + 16) / 116,
1664
+ z: 0
1665
+ };
1666
+
1667
+ xyz.x = lab2.a / 500 + xyz.y;
1668
+ xyz.z = xyz.y - lab2.b / 200;
1669
+
1670
+ xyz.x = (Math.pow(xyz.x, 3) > 0.008856) ? Math.pow(xyz.x, 3) : (xyz.x - 16 / 116) / 7.787;
1671
+ xyz.y = (Math.pow(xyz.y, 3) > 0.008856) ? Math.pow(xyz.y, 3) : (xyz.y - 16 / 116) / 7.787;
1672
+ xyz.z = (Math.pow(xyz.z, 3) > 0.008856) ? Math.pow(xyz.z, 3) : (xyz.z - 16 / 116) / 7.787;
1673
+
1674
+ xyz.x *= illuminant[0];
1675
+ xyz.y *= illuminant[1];
1676
+ xyz.z *= illuminant[2];
1677
+
1678
+ return xyz;
1679
+ },
1680
+ _rgb_to_cmy = function(rgb) {
1681
+ return {
1682
+ c: 1 - (rgb.r),
1683
+ m: 1 - (rgb.g),
1684
+ y: 1 - (rgb.b)
1685
+ };
1686
+ },
1687
+ _cmy_to_rgb = function(cmy) {
1688
+ return {
1689
+ r: 1 - (cmy.c),
1690
+ g: 1 - (cmy.m),
1691
+ b: 1 - (cmy.y)
1692
+ };
1693
+ },
1694
+ _cmy_to_cmyk = function(cmy) {
1695
+ var K = 1;
1696
+
1697
+ if (cmy.c < K) {
1698
+ K = cmy.c;
1699
+ }
1700
+ if (cmy.m < K) {
1701
+ K = cmy.m;
1702
+ }
1703
+ if (cmy.y < K) {
1704
+ K = cmy.y;
1705
+ }
1706
+
1707
+ if (K === 1) {
1708
+ return {
1709
+ c: 0,
1710
+ m: 0,
1711
+ y: 0,
1712
+ k: 1
1713
+ };
1714
+ }
1715
+
1716
+ return {
1717
+ c: (cmy.c - K) / (1 - K),
1718
+ m: (cmy.m - K) / (1 - K),
1719
+ y: (cmy.y - K) / (1 - K),
1720
+ k: K
1721
+ };
1722
+ },
1723
+ _cmyk_to_cmy = function(cmyk) {
1724
+ return {
1725
+ c: cmyk.c * (1 - cmyk.k) + cmyk.k,
1726
+ m: cmyk.m * (1 - cmyk.k) + cmyk.k,
1727
+ y: cmyk.y * (1 - cmyk.k) + cmyk.k
1728
+ };
1729
+ };
1730
+
1731
+ this.set = false;
1732
+
1733
+ this.setAlpha = function(_a) {
1734
+ if (_a !== null) {
1735
+ a = _clip(_a);
1736
+ }
1737
+ this.set = true;
1738
+
1739
+ return this;
1740
+ };
1741
+
1742
+ this.getAlpha = function() {
1743
+ return a;
1744
+ };
1745
+
1746
+ this.setRGB = function(r, g, b) {
1747
+ spaces = { rgb: this.getRGB() };
1748
+ if (r !== null) {
1749
+ spaces.rgb.r = _clip(r);
1750
+ }
1751
+ if (g !== null) {
1752
+ spaces.rgb.g = _clip(g);
1753
+ }
1754
+ if (b !== null) {
1755
+ spaces.rgb.b = _clip(b);
1756
+ }
1757
+ this.set = true;
1758
+
1759
+ return this;
1760
+ };
1761
+
1762
+ this.setHSV = function(h, s, v) {
1763
+ spaces = {hsv: this.getHSV()};
1764
+ if (h !== null) {
1765
+ spaces.hsv.h = _clip(h);
1766
+ }
1767
+ if (s !== null) {
1768
+ spaces.hsv.s = _clip(s);
1769
+ }
1770
+ if (v !== null) {
1771
+ spaces.hsv.v = _clip(v);
1772
+ }
1773
+ this.set = true;
1774
+
1775
+ return this;
1776
+ };
1777
+
1778
+ this.setHSL = function(h, s, l) {
1779
+ spaces = {hsl: this.getHSL()};
1780
+ if (h !== null) {
1781
+ spaces.hsl.h = _clip(h);
1782
+ }
1783
+ if (s !== null) {
1784
+ spaces.hsl.s = _clip(s);
1785
+ }
1786
+ if (l !== null) {
1787
+ spaces.hsl.l = _clip(l);
1788
+ }
1789
+ this.set = true;
1790
+
1791
+ return this;
1792
+ };
1793
+
1794
+ this.setLAB = function(l, a, b) {
1795
+ spaces = {lab: this.getLAB()};
1796
+ if (l !== null) {
1797
+ spaces.lab.l = _clip(l);
1798
+ }
1799
+ if (a !== null) {
1800
+ spaces.lab.a = _clip(a);
1801
+ }
1802
+ if (b !== null) {
1803
+ spaces.lab.b = _clip(b);
1804
+ }
1805
+ this.set = true;
1806
+
1807
+ return this;
1808
+ };
1809
+
1810
+ this.setCMYK = function(c, m, y, k) {
1811
+ spaces = {cmyk: this.getCMYK()};
1812
+ if (c !== null) {
1813
+ spaces.cmyk.c = _clip(c);
1814
+ }
1815
+ if (m !== null) {
1816
+ spaces.cmyk.m = _clip(m);
1817
+ }
1818
+ if (y !== null) {
1819
+ spaces.cmyk.y = _clip(y);
1820
+ }
1821
+ if (k !== null) {
1822
+ spaces.cmyk.k = _clip(k);
1823
+ }
1824
+ this.set = true;
1825
+
1826
+ return this;
1827
+ };
1828
+
1829
+ this.getRGB = function() {
1830
+ if (!spaces.rgb) {
1831
+ spaces.rgb = spaces.lab ? _xyz_to_rgb(_lab_to_xyz(spaces.lab))
1832
+ : spaces.hsv ? _hsv_to_rgb(spaces.hsv)
1833
+ : spaces.hsl ? _hsl_to_rgb(spaces.hsl)
1834
+ : spaces.cmyk ? _cmy_to_rgb(_cmyk_to_cmy(spaces.cmyk))
1835
+ : {r: 0, g: 0, b: 0};
1836
+ spaces.rgb.r = _clip(spaces.rgb.r);
1837
+ spaces.rgb.g = _clip(spaces.rgb.g);
1838
+ spaces.rgb.b = _clip(spaces.rgb.b);
1839
+ }
1840
+ return $.extend({}, spaces.rgb);
1841
+ };
1842
+
1843
+ this.getHSV = function() {
1844
+ if (!spaces.hsv) {
1845
+ spaces.hsv = spaces.lab ? _rgb_to_hsv(this.getRGB())
1846
+ : spaces.rgb ? _rgb_to_hsv(spaces.rgb)
1847
+ : spaces.hsl ? _rgb_to_hsv(this.getRGB())
1848
+ : spaces.cmyk ? _rgb_to_hsv(this.getRGB())
1849
+ : {h: 0, s: 0, v: 0};
1850
+ spaces.hsv.h = _clip(spaces.hsv.h);
1851
+ spaces.hsv.s = _clip(spaces.hsv.s);
1852
+ spaces.hsv.v = _clip(spaces.hsv.v);
1853
+ }
1854
+ return $.extend({}, spaces.hsv);
1855
+ };
1856
+
1857
+ this.getHSL = function() {
1858
+ if (!spaces.hsl) {
1859
+ spaces.hsl = spaces.rgb ? _rgb_to_hsl(spaces.rgb)
1860
+ : spaces.hsv ? _rgb_to_hsl(this.getRGB())
1861
+ : spaces.cmyk ? _rgb_to_hsl(this.getRGB())
1862
+ : spaces.hsv ? _rgb_to_hsl(this.getRGB())
1863
+ : {h: 0, s: 0, l: 0};
1864
+ spaces.hsl.h = _clip(spaces.hsl.h);
1865
+ spaces.hsl.s = _clip(spaces.hsl.s);
1866
+ spaces.hsl.l = _clip(spaces.hsl.l);
1867
+ }
1868
+ return $.extend({}, spaces.hsl);
1869
+ };
1870
+
1871
+ this.getCMYK = function() {
1872
+ if (!spaces.cmyk) {
1873
+ spaces.cmyk = spaces.rgb ? _cmy_to_cmyk(_rgb_to_cmy(spaces.rgb))
1874
+ : spaces.hsv ? _cmy_to_cmyk(_rgb_to_cmy(this.getRGB()))
1875
+ : spaces.hsl ? _cmy_to_cmyk(_rgb_to_cmy(this.getRGB()))
1876
+ : spaces.lab ? _cmy_to_cmyk(_rgb_to_cmy(this.getRGB()))
1877
+ : {c: 0, m: 0, y: 0, k: 1};
1878
+ spaces.cmyk.c = _clip(spaces.cmyk.c);
1879
+ spaces.cmyk.m = _clip(spaces.cmyk.m);
1880
+ spaces.cmyk.y = _clip(spaces.cmyk.y);
1881
+ spaces.cmyk.k = _clip(spaces.cmyk.k);
1882
+ }
1883
+ return $.extend({}, spaces.cmyk);
1884
+ };
1885
+
1886
+ this.getLAB = function() {
1887
+ if (!spaces.lab) {
1888
+ spaces.lab = spaces.rgb ? _xyz_to_lab(_rgb_to_xyz(spaces.rgb))
1889
+ : spaces.hsv ? _xyz_to_lab(_rgb_to_xyz(this.getRGB()))
1890
+ : spaces.hsl ? _xyz_to_lab(_rgb_to_xyz(this.getRGB()))
1891
+ : spaces.cmyk ? _xyz_to_lab(_rgb_to_xyz(this.getRGB()))
1892
+ : {l: 0, a: 0, b: 0};
1893
+ spaces.lab.l = _clip(spaces.lab.l);
1894
+ spaces.lab.a = _clip(spaces.lab.a);
1895
+ spaces.lab.b = _clip(spaces.lab.b);
1896
+ }
1897
+ return $.extend({}, spaces.lab);
1898
+ };
1899
+
1900
+ this.getChannels = function() {
1901
+ return {
1902
+ r: this.getRGB().r,
1903
+ g: this.getRGB().g,
1904
+ b: this.getRGB().b,
1905
+ a: this.getAlpha(),
1906
+ h: this.getHSV().h,
1907
+ s: this.getHSV().s,
1908
+ v: this.getHSV().v,
1909
+ c: this.getCMYK().c,
1910
+ m: this.getCMYK().m,
1911
+ y: this.getCMYK().y,
1912
+ k: this.getCMYK().k,
1913
+ L: this.getLAB().l,
1914
+ A: this.getLAB().a,
1915
+ B: this.getLAB().b
1916
+ };
1917
+ };
1918
+
1919
+ this.getSpaces = function() {
1920
+ return $.extend(true, {}, spaces);
1921
+ };
1922
+
1923
+ this.distance = function(color) {
1924
+ var space = 'lab',
1925
+ getter = 'get'+space.toUpperCase(),
1926
+ a = this[getter](),
1927
+ b = color[getter](),
1928
+ distance = 0,
1929
+ channel;
1930
+
1931
+ for (channel in a) {
1932
+ distance += Math.pow(a[channel] - b[channel], 2);
1933
+ }
1934
+
1935
+ return distance;
1936
+ };
1937
+
1938
+ this.equals = function(color) {
1939
+ var a = this.getRGB(),
1940
+ b = color.getRGB();
1941
+
1942
+ return this.getAlpha() === color.getAlpha()
1943
+ && a.r === b.r
1944
+ && a.g === b.g
1945
+ && a.b === b.b;
1946
+ };
1947
+
1948
+ this.limit = function(steps) {
1949
+ steps -= 1;
1950
+ var rgb = this.getRGB();
1951
+ this.setRGB(
1952
+ Math.round(rgb.r * steps) / steps,
1953
+ Math.round(rgb.g * steps) / steps,
1954
+ Math.round(rgb.b * steps) / steps
1955
+ );
1956
+ };
1957
+
1958
+ this.toHex = function() {
1959
+ var rgb = this.getRGB();
1960
+ return _hexify(rgb.r * 255) + _hexify(rgb.g * 255) + _hexify(rgb.b * 255);
1961
+ };
1962
+
1963
+ this.toCSS = function() {
1964
+ return '#' + this.toHex();
1965
+ };
1966
+
1967
+ this.copy = function() {
1968
+ var color = new $.colorpicker.Color(this.getSpaces(), this.getAlpha());
1969
+ color.set = this.set;
1970
+ return color;
1971
+ };
1972
+
1973
+ // Construct
1974
+ if (args.length === 2) {
1975
+ spaces = args[0];
1976
+ this.setAlpha(args[1] === 0 ? 0 : args[1] || 1);
1977
+ this.set = true;
1978
+ }
1979
+ if (args.length > 2) {
1980
+ this.setRGB(args[0], args[1], args[2]);
1981
+ this.setAlpha(args[3] === 0 ? 0 : args[3] || 1);
1982
+ this.set = true;
1983
+ }
1984
+ };
1985
+ }();
1986
+
1987
+ $.widget("vanderlee.colorpicker", {
1988
+ options: {
1989
+ alpha: false, // Show alpha controls and mode
1990
+ altAlpha: true, // change opacity of altField as well?
1991
+ altField: '', // selector for DOM elements which change background color on change.
1992
+ altOnChange: true, // true to update on each change, false to update only on close.
1993
+ altProperties: 'background-color', // comma separated list of any of 'background-color', 'color', 'border-color', 'outline-color'
1994
+ autoOpen: false, // Open dialog automatically upon creation
1995
+ buttonClass: null, // If set, the button will get this/these classname(s).
1996
+ buttonColorize: false,
1997
+ buttonImage: 'images/ui-colorpicker.png',
1998
+ buttonImageOnly: false,
1999
+ buttonText: null, // Text on the button and/or title of button image.
2000
+ closeOnEscape: true, // Close the dialog when the escape key is pressed.
2001
+ closeOnOutside: true, // Close the dialog when clicking outside the dialog (not for inline)
2002
+ color: '#00FF00', // Initial color (for inline only)
2003
+ colorFormat: 'HEX', // Format string for output color format
2004
+ draggable: true, // Make popup dialog draggable if header is visible.
2005
+ containment: null, // Constrains dragging to within the bounds of the specified element or region.
2006
+ duration: 'fast',
2007
+ hsv: true, // Show HSV controls and modes
2008
+ inline: true, // Show any divs as inline by default
2009
+ inlineFrame: true, // Show a border and background when inline.
2010
+ layout: {
2011
+ map: [0, 0, 1, 5], // Left, Top, Width, Height (in table cells).
2012
+ bar: [1, 0, 1, 5],
2013
+ preview: [2, 0, 1, 1],
2014
+ hsv: [2, 1, 1, 1],
2015
+ rgb: [2, 2, 1, 1],
2016
+ alpha: [2, 3, 1, 1],
2017
+ hex: [2, 4, 1, 1],
2018
+ lab: [3, 1, 1, 1],
2019
+ cmyk: [3, 2, 1, 2],
2020
+ swatches: [4, 0, 1, 5]
2021
+ },
2022
+ limit: '', // Limit color "resolution": '', 'websafe', 'nibble', 'binary', 'name'
2023
+ modal: false, // Modal dialog?
2024
+ mode: 'h', // Initial editing mode, h, s, v, r, g, b or a
2025
+ okOnEnter: false, // Close (with OK) when pressing the enter key
2026
+ parts: '', // leave empty for automatic selection
2027
+ part: {
2028
+ map: { size: 256 },
2029
+ bar: { size: 256 }
2030
+ }, // options per part
2031
+ regional: '',
2032
+ revert: false, // Revert color upon non
2033
+ rgb: true, // Show RGB controls and modes
2034
+ showAnim: 'fadeIn',
2035
+ showCancelButton: true,
2036
+ showNoneButton: false,
2037
+ showCloseButton: true,
2038
+ showOn: 'focus click alt', // 'focus', 'click', 'button', 'alt', 'both'
2039
+ showOptions: {},
2040
+ swatches: null, // null for default or kv-object or names swatches set
2041
+ swatchesWidth: 84, // width (in number of pixels) of swatches box.
2042
+ title: null,
2043
+
2044
+ cancel: null,
2045
+ close: null,
2046
+ init: null,
2047
+ select: null,
2048
+ ok: null,
2049
+ open: null
2050
+ },
2051
+
2052
+ _create: function () {
2053
+ var that = this,
2054
+ text;
2055
+
2056
+ ++_colorpicker_index;
2057
+
2058
+ that.widgetEventPrefix = 'colorpicker';
2059
+
2060
+ that.opened = false;
2061
+ that.generated = false;
2062
+ that.inline = false;
2063
+ that.changed = false;
2064
+
2065
+ that.dialog = null;
2066
+ that.button = null;
2067
+ that.image = null;
2068
+ that.overlay = null;
2069
+
2070
+ that.mode = that.options.mode;
2071
+
2072
+ if (that.element.is('input') || that.options.inline === false) {
2073
+ // Initial color
2074
+ that._setColor(that.element.is('input') ? that.element.val() : that.options.color);
2075
+ that._callback('init');
2076
+
2077
+ // showOn focus
2078
+ if (/\bfocus|both\b/.test(that.options.showOn)) {
2079
+ that.element.bind('focus', function () {
2080
+ that.open();
2081
+ });
2082
+ }
2083
+
2084
+ // showOn click
2085
+ if (/\bclick|both\b/.test(that.options.showOn)) {
2086
+ that.element.bind('click', function () {
2087
+ that.open();
2088
+ });
2089
+ }
2090
+
2091
+ // showOn button
2092
+ if (/\bbutton|both\b/.test(that.options.showOn)) {
2093
+ if (that.options.buttonImage !== '') {
2094
+ text = that.options.buttonText || that._getRegional('button');
2095
+
2096
+ that.image = $('<img/>').attr({
2097
+ 'src': that.options.buttonImage,
2098
+ 'alt': text,
2099
+ 'title': text
2100
+ });
2101
+ if (that.options.buttonClass) {
2102
+ that.image.attr('class', that.options.buttonClass);
2103
+ }
2104
+
2105
+ that._setImageBackground();
2106
+ }
2107
+
2108
+ if (that.options.buttonImageOnly && that.image) {
2109
+ that.button = that.image;
2110
+ } else {
2111
+ that.button = $('<button type="button"></button>').html(that.image || that.options.buttonText).button();
2112
+ that.image = that.image ? $('img', that.button).first() : null;
2113
+ }
2114
+ that.button.insertAfter(that.element).click(function () {
2115
+ that[that.opened ? 'close' : 'open']();
2116
+ });
2117
+ }
2118
+
2119
+ // showOn alt
2120
+ if (/\balt|both\b/.test(that.options.showOn)) {
2121
+ $(that.options.altField).bind('click', function () {
2122
+ that.open();
2123
+ });
2124
+ }
2125
+
2126
+ if (that.options.autoOpen) {
2127
+ that.open();
2128
+ }
2129
+ } else {
2130
+ that.inline = true;
2131
+
2132
+ that._generate();
2133
+ that.opened = true;
2134
+ }
2135
+
2136
+ return this;
2137
+ },
2138
+
2139
+ _setOption: function(key, value){
2140
+ var that = this;
2141
+
2142
+ switch (key) {
2143
+ case "disabled":
2144
+ if (value) {
2145
+ that.dialog.addClass('ui-colorpicker-disabled');
2146
+ } else {
2147
+ that.dialog.removeClass('ui-colorpicker-disabled');
2148
+ }
2149
+ break;
2150
+ }
2151
+
2152
+ $.Widget.prototype._setOption.apply(that, arguments);
2153
+ },
2154
+
2155
+ _setImageBackground: function() {
2156
+ if (this.image && this.options.buttonColorize) {
2157
+ this.image.css('background-color', this.color.set? this._formatColor('RGBA', this.color) : '');
2158
+ }
2159
+ },
2160
+
2161
+ /**
2162
+ * If an alternate field is specified, set it according to the current color.
2163
+ */
2164
+ _setAltField: function () {
2165
+ if (this.options.altOnChange && this.options.altField && this.options.altProperties) {
2166
+ var index,
2167
+ property,
2168
+ properties = this.options.altProperties.split(',');
2169
+
2170
+ for (index = 0; index <= properties.length; ++index) {
2171
+ property = $.trim(properties[index]);
2172
+ switch (property) {
2173
+ case 'color':
2174
+ case 'fill':
2175
+ case 'stroke':
2176
+ case 'background-color':
2177
+ case 'backgroundColor':
2178
+ case 'outline-color':
2179
+ case 'border-color':
2180
+ $(this.options.altField).css(property, this.color.set? this.color.toCSS() : '');
2181
+ break;
2182
+ }
2183
+ }
2184
+
2185
+ if (this.options.altAlpha) {
2186
+ $(this.options.altField).css('opacity', this.color.set? this.color.getAlpha() : '');
2187
+ }
2188
+ }
2189
+ },
2190
+
2191
+ _setColor: function(text) {
2192
+ this.color = this._parseColor(text);
2193
+ this.currentColor = this.color.copy();
2194
+
2195
+ this._setImageBackground();
2196
+ this._setAltField();
2197
+ },
2198
+
2199
+ setColor: function(text) {
2200
+ this._setColor(text);
2201
+ this._change();
2202
+ },
2203
+
2204
+ getColor: function(format) {
2205
+ return this._formatColor(format || this.options.colorFormat, this.color);
2206
+ },
2207
+
2208
+ _generateInline: function() {
2209
+ var that = this;
2210
+
2211
+ $(that.element).html(that.options.inlineFrame ? _container_inlineFrame : _container_inline);
2212
+
2213
+ that.dialog = $('.ui-colorpicker', that.element);
2214
+ },
2215
+
2216
+ _generatePopup: function() {
2217
+ var that = this;
2218
+
2219
+ $('body').append(_container_popup);
2220
+ that.dialog = $('.ui-colorpicker:last');
2221
+
2222
+ // Close on clicking outside window and controls
2223
+ $(document).delegate('html', 'touchstart click', function (event) {
2224
+ if (!that.opened || event.target === that.element[0] || that.overlay) {
2225
+ return;
2226
+ }
2227
+
2228
+ // Check if clicked on any part of dialog
2229
+ if (that.dialog.is(event.target) || that.dialog.has(event.target).length > 0) {
2230
+ that.element.blur(); // inside window!
2231
+ return;
2232
+ }
2233
+
2234
+ // Check if clicked on known external elements
2235
+ var p,
2236
+ parents = $(event.target).parents();
2237
+ // add the event.target in case of buttonImageOnly and closeOnOutside both are set to true
2238
+ parents.push(event.target);
2239
+ for (p = 0; p <= parents.length; ++p) {
2240
+ // button
2241
+ if (that.button !== null && parents[p] === that.button[0]) {
2242
+ return;
2243
+ }
2244
+ // showOn alt
2245
+ if (/\balt|both\b/.test(that.options.showOn) && $(that.options.altField).is(parents[p])) {
2246
+ return;
2247
+ }
2248
+ }
2249
+
2250
+ // no closeOnOutside
2251
+ if (!that.options.closeOnOutside) {
2252
+ return;
2253
+ }
2254
+
2255
+ that.close(that.options.revert);
2256
+ });
2257
+
2258
+ $(document).keydown(function (event) {
2259
+ // close on ESC key
2260
+ if (that.opened && event.keyCode === 27 && that.options.closeOnEscape) {
2261
+ that.close(that.options.revert);
2262
+ }
2263
+
2264
+ // OK on Enter key
2265
+ if (that.opened && event.keyCode === 13 && that.options.okOnEnter) {
2266
+ that.close();
2267
+ }
2268
+ });
2269
+
2270
+ // Close (with OK) on tab key in element
2271
+ that.element.keydown(function (event) {
2272
+ if (event.keyCode === 9) {
2273
+ that.close();
2274
+ }
2275
+ }).keyup(function (event) {
2276
+ var color = that._parseColor(that.element.val());
2277
+ if (!that.color.equals(color)) {
2278
+ that.color = color;
2279
+ that._change();
2280
+ }
2281
+ });
2282
+ },
2283
+
2284
+ _generate: function () {
2285
+ var that = this,
2286
+ index,
2287
+ part,
2288
+ parts_list,
2289
+ layout_parts,
2290
+ table,
2291
+ classes;
2292
+
2293
+ that._setColor(that.inline || !that.element.is('input') ? that.options.color : that.element.val());
2294
+
2295
+ that[that.inline ? '_generateInline' : '_generatePopup']();
2296
+
2297
+ // Determine the parts to include in this colorpicker
2298
+ if (typeof that.options.parts === 'string') {
2299
+ if ($.colorpicker.partslists[that.options.parts]) {
2300
+ parts_list = $.colorpicker.partslists[that.options.parts];
2301
+ } else {
2302
+ // automatic
2303
+ parts_list = $.colorpicker.partslists[that.inline ? 'inline' : 'popup'];
2304
+ }
2305
+ } else {
2306
+ parts_list = that.options.parts;
2307
+ }
2308
+
2309
+ // Add any parts to the internal parts list
2310
+ that.parts = {};
2311
+ $.each(parts_list, function(index, part) {
2312
+ if ($.colorpicker.parts[part]) {
2313
+ that.parts[part] = new $.colorpicker.parts[part](that);
2314
+ }
2315
+ });
2316
+
2317
+ if (!that.generated) {
2318
+ layout_parts = [];
2319
+
2320
+ $.each(that.options.layout, function(part, pos) {
2321
+ if (that.parts[part]) {
2322
+ layout_parts.push({
2323
+ 'part': part,
2324
+ 'pos': pos
2325
+ });
2326
+ }
2327
+ });
2328
+
2329
+ table = $(_layoutTable(layout_parts, function(cell, x, y) {
2330
+ classes = ['ui-colorpicker-' + cell.part + '-container'];
2331
+
2332
+ if (x > 0) {
2333
+ classes.push('ui-colorpicker-padding-left');
2334
+ }
2335
+
2336
+ if (y > 0) {
2337
+ classes.push('ui-colorpicker-padding-top');
2338
+ }
2339
+
2340
+ return '<td class="' + classes.join(' ') + '"'
2341
+ + (cell.pos[2] > 1 ? ' colspan="' + cell.pos[2] + '"' : '')
2342
+ + (cell.pos[3] > 1 ? ' rowspan="' + cell.pos[3] + '"' : '')
2343
+ + ' valign="top"></td>';
2344
+ })).appendTo(that.dialog);
2345
+ if (that.options.inlineFrame) {
2346
+ table.addClass('ui-dialog-content ui-widget-content');
2347
+ }
2348
+
2349
+ that._initAllParts();
2350
+ that._updateAllParts();
2351
+ that.generated = true;
2352
+ }
2353
+ },
2354
+
2355
+ _effectGeneric: function (element, show, slide, fade, callback) {
2356
+ var that = this;
2357
+
2358
+ if ($.effects && $.effects[that.options.showAnim]) {
2359
+ element[show](that.options.showAnim, that.options.showOptions, that.options.duration, callback);
2360
+ } else {
2361
+ element[(that.options.showAnim === 'slideDown' ?
2362
+ slide
2363
+ : (that.options.showAnim === 'fadeIn' ?
2364
+ fade
2365
+ : show))]((that.options.showAnim ? that.options.duration : null), callback);
2366
+ if (!that.options.showAnim || !that.options.duration) {
2367
+ callback();
2368
+ }
2369
+ }
2370
+ },
2371
+
2372
+ _effectShow: function(element, callback) {
2373
+ this._effectGeneric(element, 'show', 'slideDown', 'fadeIn', callback);
2374
+ },
2375
+
2376
+ _effectHide: function(element, callback) {
2377
+ this._effectGeneric(element, 'hide', 'slideUp', 'fadeOut', callback);
2378
+ },
2379
+
2380
+ open: function() {
2381
+ var that = this,
2382
+ offset,
2383
+ bottom, right,
2384
+ height, width,
2385
+ x, y,
2386
+ zIndex,
2387
+ hiddenPlaceholder;
2388
+
2389
+ if (!that.opened) {
2390
+ that._generate();
2391
+
2392
+ if (that.element.is(':hidden')) {
2393
+ hiddenPlaceholder = $('<div/>').insertBefore(that.element);
2394
+ offset = hiddenPlaceholder.offset();
2395
+ hiddenPlaceholder.remove();
2396
+ } else {
2397
+ offset = that.element.offset();
2398
+ }
2399
+ bottom = $(window).height() + $(window).scrollTop();
2400
+ right = $(window).width() + $(window).scrollLeft();
2401
+ height = that.dialog.outerHeight(false);
2402
+ width = that.dialog.outerWidth();
2403
+ x = offset.left;
2404
+ y = offset.top + that.element.outerHeight(false);
2405
+
2406
+ if (x + width > right) {
2407
+ x = Math.max(0, right - width);
2408
+ }
2409
+
2410
+ if (y + height > bottom) {
2411
+ if (offset.top - height >= $(window).scrollTop()) {
2412
+ y = offset.top - height;
2413
+ } else {
2414
+ y = Math.max(0, bottom - height);
2415
+ }
2416
+ }
2417
+
2418
+ that.dialog.css({'left': x, 'top': y});
2419
+
2420
+ // Automatically find highest z-index.
2421
+ zIndex = 0;
2422
+ $(that.element[0]).parents().each(function() {
2423
+ var z = $(this).css('z-index');
2424
+ if ((typeof(z) === 'number' || typeof(z) === 'string') && z !== '' && !isNaN(z)) {
2425
+ if (z > zIndex) {
2426
+ zIndex = parseInt(z, 10);
2427
+ return false;
2428
+ }
2429
+ }
2430
+ else {
2431
+ $(this).siblings().each(function() {
2432
+ var z = $(this).css('z-index');
2433
+ if ((typeof(z) === 'number' || typeof(z) === 'string') && z !== '' && !isNaN(z)) {
2434
+ if (z > zIndex) {
2435
+ zIndex = parseInt(z, 10);
2436
+ }
2437
+ }
2438
+ });
2439
+ }
2440
+ });
2441
+
2442
+ // @todo zIndexOffset option, to raise above other elements?
2443
+ that.dialog.css('z-index', zIndex += 2);
2444
+
2445
+ that.overlay = that.options.modal ? new $.ui.dialog.overlay(that) : null;
2446
+ if (that.overlay !== null) {
2447
+ var z = that.overlay.$el.css('z-index');
2448
+ if ((typeof(z) === 'number' || typeof(z) === 'string') && z !== '' && !isNaN(z)) {
2449
+ that.dialog.css('z-index', zIndex + z + 2);
2450
+ }
2451
+ }
2452
+
2453
+ that._effectShow(this.dialog);
2454
+ that.opened = true;
2455
+ that._callback('open', true);
2456
+
2457
+ // Without waiting for domready the width of the map is 0 and we
2458
+ // wind up with the cursor stuck in the upper left corner
2459
+ $(function() {
2460
+ that._repaintAllParts();
2461
+ });
2462
+ }
2463
+ },
2464
+
2465
+ close: function (cancel) {
2466
+ var that = this;
2467
+
2468
+ //ZP-ADDITION:1 Ignore subsequent calls for already closed dialog
2469
+ if (!that.opened)
2470
+ return;
2471
+
2472
+ if (cancel) {
2473
+ that.color = that.currentColor.copy();
2474
+ that._change();
2475
+ that._callback('cancel', true);
2476
+ } else {
2477
+ that.currentColor = that.color.copy();
2478
+ that._callback('ok', true);
2479
+ }
2480
+ that.changed = false;
2481
+
2482
+ // tear down the interface
2483
+ that._effectHide(that.dialog, function () {
2484
+ that.dialog.remove();
2485
+ that.dialog = null;
2486
+ that.generated = false;
2487
+
2488
+ that.opened = false;
2489
+ that._callback('close', true);
2490
+ });
2491
+
2492
+ if (that.overlay) {
2493
+ that.overlay.destroy();
2494
+ }
2495
+ },
2496
+
2497
+ destroy: function() {
2498
+ this.element.unbind();
2499
+
2500
+ if (this.image !== null) {
2501
+ this.image.remove();
2502
+ }
2503
+
2504
+ if (this.button !== null) {
2505
+ this.button.remove();
2506
+ }
2507
+
2508
+ if (this.dialog !== null) {
2509
+ this.dialog.remove();
2510
+ }
2511
+
2512
+ if (this.overlay) {
2513
+ this.overlay.destroy();
2514
+ }
2515
+ },
2516
+
2517
+ _callback: function (callback, spaces) {
2518
+ var that = this,
2519
+ data,
2520
+ lab;
2521
+
2522
+ if (that.color.set) {
2523
+ data = {
2524
+ formatted: that._formatColor(that.options.colorFormat, that.color),
2525
+ colorPicker: that
2526
+ };
2527
+
2528
+ lab = that.color.getLAB();
2529
+ lab.a = (lab.a * 2) - 1;
2530
+ lab.b = (lab.b * 2) - 1;
2531
+
2532
+ if (spaces === true) {
2533
+ data.a = that.color.getAlpha();
2534
+ data.rgb = that.color.getRGB();
2535
+ data.hsv = that.color.getHSV();
2536
+ data.cmyk = that.color.getCMYK();
2537
+ data.hsl = that.color.getHSL();
2538
+ data.lab = lab;
2539
+ }
2540
+
2541
+ return that._trigger(callback, null, data);
2542
+ } else {
2543
+ return that._trigger(callback, null, {
2544
+ formatted: '',
2545
+ colorPicker: that
2546
+ });
2547
+ }
2548
+ },
2549
+
2550
+ _initAllParts: function () {
2551
+ $.each(this.parts, function (index, part) {
2552
+ if (part.init) {
2553
+ part.init();
2554
+ }
2555
+ });
2556
+ },
2557
+
2558
+ _updateAllParts: function () {
2559
+ $.each(this.parts, function (index, part) {
2560
+ if (part.update) {
2561
+ part.update();
2562
+ }
2563
+ });
2564
+ },
2565
+
2566
+ _repaintAllParts: function () {
2567
+ $.each(this.parts, function (index, part) {
2568
+ if (part.repaint) {
2569
+ part.repaint();
2570
+ }
2571
+ });
2572
+ },
2573
+
2574
+ _change: function () {
2575
+ this.changed = true;
2576
+
2577
+ // Limit color palette
2578
+ if (this.options.limit && $.colorpicker.limits[this.options.limit]) {
2579
+ $.colorpicker.limits[this.options.limit](this.color, this);
2580
+ }
2581
+
2582
+ // update input element content
2583
+ if (!this.inline) {
2584
+ if (!this.color.set) {
2585
+ this.element.val('');
2586
+ } else if (!this.color.equals(this._parseColor(this.element.val()))) {
2587
+ this.element.val(this._formatColor(this.options.colorFormat, this.color));
2588
+ }
2589
+
2590
+ this._setImageBackground();
2591
+ this._setAltField();
2592
+ }
2593
+
2594
+ // update color option
2595
+ this.options.color = this.color.set ? this.color.toCSS() : '';
2596
+
2597
+ if (this.opened) {
2598
+ this._repaintAllParts();
2599
+ }
2600
+
2601
+ // callback
2602
+ this._callback('select');
2603
+ },
2604
+
2605
+ // This will be deprecated by jQueryUI 1.9 widget
2606
+ _hoverable: function (e) {
2607
+ e.hover(function () {
2608
+ e.addClass("ui-state-hover");
2609
+ }, function () {
2610
+ e.removeClass("ui-state-hover");
2611
+ });
2612
+ },
2613
+
2614
+ // This will be deprecated by jQueryUI 1.9 widget
2615
+ _focusable: function (e) {
2616
+ e.focus(function () {
2617
+ e.addClass("ui-state-focus");
2618
+ }).blur(function () {
2619
+ e.removeClass("ui-state-focus");
2620
+ });
2621
+ },
2622
+
2623
+ _getRegional: function(name) {
2624
+ return $.colorpicker.regional[this.options.regional][name] !== undefined ?
2625
+ $.colorpicker.regional[this.options.regional][name] : $.colorpicker.regional[''][name];
2626
+ },
2627
+
2628
+ _getSwatches: function() {
2629
+ if (typeof(this.options.swatches) === 'string') {
2630
+ return $.colorpicker.swatches[this.options.swatches];
2631
+ }
2632
+
2633
+ if ($.isPlainObject(this.options.swatches)) {
2634
+ return this.colorpicker.swatches;
2635
+ }
2636
+
2637
+ return $.colorpicker.swatches.html;
2638
+ },
2639
+
2640
+ _eachSwatch: function (callback) {
2641
+ var currentSwatches = this._getSwatches();
2642
+ var name;
2643
+ $.each(currentSwatches, function (nameOrIndex, swatch) {
2644
+ if ($.isArray(currentSwatches)) {
2645
+ name = swatch.name;
2646
+ } else {
2647
+ name = nameOrIndex;
2648
+ }
2649
+ callback(name, swatch);
2650
+ });
2651
+ },
2652
+
2653
+ _getSwatch: function(name) {
2654
+ var swatch = false;
2655
+
2656
+ this._eachSwatch(function(swatchName, current) {
2657
+ if (swatchName.toLowerCase() == name.toLowerCase()) {
2658
+ swatch = current;
2659
+ return false;
2660
+ }
2661
+ return true;
2662
+ });
2663
+
2664
+ return swatch;
2665
+ },
2666
+
2667
+ _parseColor: function(color) {
2668
+ var that = this,
2669
+ c;
2670
+
2671
+ $.each($.colorpicker.parsers, function(name, parser) {
2672
+ c = parser(color, that);
2673
+ if (c) {
2674
+ return false;
2675
+ }
2676
+ });
2677
+
2678
+ if (c) {
2679
+ return c;
2680
+ }
2681
+
2682
+ return new $.colorpicker.Color();
2683
+ },
2684
+
2685
+ _exactName: function(color) {
2686
+ var name = false;
2687
+
2688
+ this._eachSwatch(function(n, swatch) {
2689
+ if (color.equals(new $.colorpicker.Color(swatch.r, swatch.g, swatch.b))) {
2690
+ name = n;
2691
+ return false;
2692
+ }
2693
+ return true;
2694
+ });
2695
+
2696
+ return name;
2697
+ },
2698
+
2699
+ _closestName: function(color) {
2700
+ var rgb = color.getRGB(),
2701
+ distance = null,
2702
+ name = false,
2703
+ d;
2704
+
2705
+ this._eachSwatch(function(n, swatch) {
2706
+ d = color.distance(new $.colorpicker.Color(swatch.r, swatch.g, swatch.b));
2707
+ if (d < distance || distance === null) {
2708
+ name = n;
2709
+ if (d === 0) {
2710
+ return false; // can't get much closer than 0
2711
+ }
2712
+ distance = d;
2713
+ }
2714
+ return true;
2715
+ });
2716
+
2717
+ return name;
2718
+ },
2719
+
2720
+ _formatColor: function (formats, color) {
2721
+ var that = this,
2722
+ text = null,
2723
+ types = { 'x': function(v) {return _intToHex(v * 255);}
2724
+ , 'd': function(v) {return Math.floor(v * 255);}
2725
+ , 'f': function(v) {return v;}
2726
+ , 'p': function(v) {return v * 100;}
2727
+ },
2728
+ channels = color.getChannels();
2729
+
2730
+ if (!$.isArray(formats)) {
2731
+ formats = [formats];
2732
+ }
2733
+
2734
+ $.each(formats, function(index, format) {
2735
+ if ($.colorpicker.writers[format]) {
2736
+ text = $.colorpicker.writers[format](color, that);
2737
+ return (text === false);
2738
+ } else {
2739
+ text = format.replace(/\\?[argbhsvcmykLAB][xdfp]/g, function(m) {
2740
+ if (m.match(/^\\/)) {
2741
+ return m.slice(1);
2742
+ }
2743
+ return types[m.charAt(1)](channels[m.charAt(0)]);
2744
+ });
2745
+ return false;
2746
+ }
2747
+ });
2748
+
2749
+ return text;
2750
+ }
2751
+ });
2752
+ }(jQuery));
js/zetaprints/colorpicker/images/128/bar-alpha.png ADDED
Binary file
js/zetaprints/colorpicker/images/128/bar.png ADDED
Binary file
js/zetaprints/colorpicker/images/128/map.png ADDED
Binary file
js/zetaprints/colorpicker/images/bar-alpha.png ADDED
Binary file
js/zetaprints/colorpicker/images/bar-opacity.png ADDED
Binary file
js/zetaprints/colorpicker/images/bar-pointer.png ADDED
Binary file
js/zetaprints/colorpicker/images/bar.png ADDED
Binary file
js/zetaprints/colorpicker/images/map-opacity.png ADDED
Binary file
js/zetaprints/colorpicker/images/map-pointer.png ADDED
Binary file
js/zetaprints/colorpicker/images/map.png ADDED
Binary file
js/zetaprints/colorpicker/images/preview-opacity.png ADDED
Binary file
js/zetaprints/colorpicker/images/ui-colorpicker.png ADDED
Binary file
js/zetaprints/colorpicker/switcher.js ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;jQuery(function($) {
2
+ $.colorpicker.parts.switcher = function (inst) {
3
+ this.init = function () {
4
+ var $dialog = inst.dialog,
5
+ $rgb = $('<div class="ui-colorpicker-switcher-rgb">RGB</div>'),
6
+ $cmyk = $('<div class="ui-colorpicker-switcher-cmyk">CMYK</div>');
7
+
8
+ inst.element.val(inst._formatColor('#HEX', inst.color));
9
+
10
+ $dialog.addClass('ui-colorpicker-mode-rgb');
11
+
12
+ $('<div class="ui-colorpicker-switcher"/>')
13
+ .append($rgb, $cmyk)
14
+ .appendTo($dialog);
15
+
16
+ $($rgb).on('click', function () {
17
+ if ($dialog.hasClass('ui-colorpicker-mode-rgb'))
18
+ return;
19
+
20
+ inst.options.colorFormat = '#HEX';
21
+ inst.element.val(inst._formatColor('#HEX', inst.color));
22
+
23
+ $dialog
24
+ .removeClass('ui-colorpicker-mode-cmyk')
25
+ .addClass('ui-colorpicker-mode-rgb');
26
+ });
27
+
28
+ $($cmyk).on('click', function () {
29
+ if ($dialog.hasClass('ui-colorpicker-mode-cmyk'))
30
+ return;
31
+
32
+ inst.options.colorFormat = '#CMYK';
33
+ inst.element.val(inst._formatColor('#CMYK', inst.color));
34
+
35
+ inst.mode = 'h';
36
+ inst._updateAllParts();
37
+
38
+ $dialog
39
+ .removeClass('ui-colorpicker-mode-rgb')
40
+ .addClass('ui-colorpicker-mode-cmyk');
41
+ });
42
+ };
43
+ };
44
+
45
+ $.colorpicker.writers['#CMYK'] = function (color, that) {
46
+ var cmyk = color.getCMYK(),
47
+ c = ('00' + Math.floor(cmyk.c * 255)).slice(-3),
48
+ m = ('00' + Math.floor(cmyk.m * 255)).slice(-3),
49
+ y = ('00' + Math.floor(cmyk.y * 255)).slice(-3),
50
+ k = ('00' + Math.floor(cmyk.k * 255)).slice(-3);
51
+
52
+ return '#' + c + m + y + k;
53
+ }
54
+
55
+ $.colorpicker.parsers['#CMYK'] = function (color) {
56
+ var m = /^#(\d{3})(\d{3})(\d{3})(\d{3})$/.exec(color);
57
+
58
+ if (m)
59
+ return (new $.colorpicker.Color()).setCMYK(
60
+ m[1] / 255,
61
+ m[2] / 255,
62
+ m[3] / 255,
63
+ m[4] / 255
64
+ );
65
+ }
66
+ });
js/zetaprints/zp-text-field-editor.js CHANGED
@@ -118,7 +118,7 @@
118
  var value = $(this).val();
119
 
120
  if (!value)
121
- $color_example.click()
122
  else if (value == 'default')
123
  _change('color', undefined);
124
  else
@@ -127,40 +127,43 @@
127
 
128
  var color_picker_on = false;
129
 
130
- $color_example.ColorPicker({
131
- color: '#804080',
132
-
133
- onBeforeShow: function (colpkr) {
134
- color_picker_on = true;
135
-
136
- var colour = $radio_button.val();
137
- if (colour)
138
- $(this).ColorPickerSetColor(colour);
139
-
140
- $(colpkr).draggable();
141
- return false;
142
  },
143
-
144
- onShow: function (colpkr) {
145
- $(colpkr).fadeIn(500);
146
-
147
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
148
  },
149
 
150
- onHide: function (colpkr) {
151
- $(colpkr).fadeOut(500);
152
-
153
  color_picker_on = false;
154
-
155
- return false;
156
  },
157
 
158
- onSubmit: function (hsb, hex, rgb, el) {
159
- $color_example.css('backgroundColor', '#' + hex);
160
- $radio_button.val('#' + hex).prop('checked', true);
161
- $(el).ColorPickerHide();
162
-
163
- _change('color', '#' + hex);
164
  }
165
  });
166
 
118
  var value = $(this).val();
119
 
120
  if (!value)
121
+ $radio_button.colorpicker('open');
122
  else if (value == 'default')
123
  _change('color', undefined);
124
  else
127
 
128
  var color_picker_on = false;
129
 
130
+ $radio_button.colorpicker({
131
+ color: '804080',
132
+ inline: false,
133
+ layout: {
134
+ //Left, Top, Width, Height (in table cells)
135
+ map: [0, 0, 1, 5],
136
+ bar: [1, 0, 1, 5],
137
+ preview: [2, 0, 1, 1],
138
+ rgb: [2, 2, 1, 1],
139
+ hex: [2, 3, 1, 1],
140
+ cmyk: [3, 2, 1, 2],
 
141
  },
142
+ parts: [
143
+ 'switcher', 'header', 'map', 'bar', 'hex', 'rgb', 'cmyk', 'preview',
144
+ 'footer'
145
+ ],
146
+ part: {
147
+ map: { size: 128 },
148
+ bar: { size: 128 }
149
+ },
150
+ altField: $color_example,
151
+ showOn: 'alt',
152
+ title: ' ',
153
+ revert: true,
154
+ showCloseButton: false,
155
+ colorFormat: ('#HEX'),
156
+
157
+ open: function () {
158
+ color_picker_on = true;
159
  },
160
 
161
+ close: function (colpkr) {
 
 
162
  color_picker_on = false;
 
 
163
  },
164
 
165
+ ok: function (e, data) {
166
+ _change('color', data.formatted);
 
 
 
 
167
  }
168
  });
169
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>web_to_print_store_incl_theme</name>
4
- <version>2.2.0.0</version>
5
  <stability>stable</stability>
6
  <license>mixed</license>
7
  <channel>community</channel>
@@ -21,20 +21,16 @@ Source code: http://code.google.com/p/magento-w2p/&#xD;
21
  &#xD;
22
  Technical support: admin@zetaprints.com&#xD;
23
  Extension developed by http://www.zetaprints.com/</description>
24
- <notes>* Synchronise with Magento 1.8.0.0 and 1.8.1.0 versions&#xD;
25
- * Add support for quantities in ZetaPrints templates&#xD;
26
- * Add support for colour palettes in ZetaPrints templates&#xD;
27
- * Add support for storing w2p product (previews and user input) in wishlist (issue #823)&#xD;
28
- * Allow to use dummy store for category name mapping&#xD;
29
- * Add parameter to enable assigning of created product to parent categories in profile for product creation&#xD;
30
- * Add an option to select websites for assiging of newly created products&#xD;
31
- * Re-assigned product to category on update&#xD;
32
- * Show warning when user changed data in fields but has not updated previews yet&#xD;
33
- * Other small bug fixes and improvements</notes>
34
  <authors><author><name>Anatoly A. Kazantsev</name><user>jimcrow</user><email>anatoly@zetaprints.com</email></author></authors>
35
- <date>2014-07-09</date>
36
- <time>05:57:49</time>
37
- <contents><target name="mageetc"><dir name="modules"><file name="ZetaPrints_WebToPrint.xml" hash="4690d74c958173f35baddabde4276cf4"/></dir></target><target name="magecommunity"><dir name="ZetaPrints"><dir name="WebToPrint"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><dir name="Templates"><file name="Dynamicimaging.php" hash="507a4c9dd7ebb3cca626ee37094d213e"/><file name="Radiobutton.php" hash="c1a1afb50b857211ce79dd2850f514f1"/></dir><file name="Templates.php" hash="3b5b8cb346bfdf3420ae1026034cd225"/></dir></dir></dir></dir><dir name="Customer"><file name="Sidebar.php" hash="91b271b4a80199d6aa9c048e2c89e623"/><dir name="Wishlist"><dir name="Item"><dir name="Column"><file name="Comment.php" hash="efc441b7489cc940503fe5b33db09e41"/></dir></dir></dir></dir><dir name="Html"><file name="Footer.php" hash="8567dbfd6c1f86b5c84df7869c62d933"/></dir></dir><dir name="Helper"><file name="Category.php" hash="e20ea5876c1d3948ee814f27ff90e6d5"/><file name="Data.php" hash="45e252c5076044eaa61b9ff3c398aa8a"/><file name="PersonalizationForm.php" hash="07410934919a1ae4cec10fad06304562"/></dir><dir name="Model"><file name="Config.php" hash="460c0632326e33b75bfe5d48fb05043c"/><dir name="Convert"><dir name="Mapper"><dir name="Product"><file name="Creating.php" hash="419502356b0a2cb384eccc37f77a1cbd"/><file name="Updating.php" hash="7ec4266c2f8d6c8ca7c96c5397a616ae"/></dir></dir><dir name="Parser"><file name="Catalogue.php" hash="219764bb39f9ad8711135e61113c83d1"/><file name="Template.php" hash="c2fa53784963b7596f118636ef3dd978"/></dir></dir><dir name="Events"><file name="Observer.php" hash="cdf927030b6c849b964e893e76d3f737"/></dir><file name="Item.php" hash="1c50ac1a3463b7030a572657223fa4cd"/><dir name="Profile"><file name="History.php" hash="2a59cc16cb37256eb7bdf22310e696de"/></dir><dir name="Quote"><file name="Item.php" hash="1f12b610013de10184177dc6a89a0d41"/></dir><dir name="Resource"><file name="Setup.php" hash="1e415970f4ecf42b20d7f0ee18363adb"/><dir name="Template"><file name="Collection.php" hash="c0469f86815f395f33028dca3456257d"/></dir><file name="Template.php" hash="82b24eb29c98ec58de75894826ae4b66"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Apikey.php" hash="089da852bd20b5fe579eef455a8404df"/><file name="FileUploadingLimit.php" hash="dcaf5a851a8d36f6ab09d65a2626b006"/><file name="ZetaPrintsUrl.php" hash="3716c4522ca04d64fd2d15b41d529152"/></dir><dir name="Source"><file name="TemplateDeletingBehaviour.php" hash="232bec5c787c616f0740297b464f737e"/></dir></dir></dir><file name="Template.php" hash="29a7e3dbecd238b05796db54a37bd622"/></dir><dir name="controllers"><dir name="Catalog"><file name="ProductController.php" hash="206b85ba57d4d6fd34bbf085e886e307"/></dir><file name="ImageController.php" hash="2058309a6b2572c2bce2c32e20851167"/><file name="OrderController.php" hash="af6fbe14a33c73d0c2357cd0483e20f0"/><file name="PhotothumbnailController.php" hash="3d5eb2626773886be58c83f11efadbe2"/><file name="PreviewController.php" hash="de28d77b356f24feaf1099c9b8b39416"/><file name="ThumbnailController.php" hash="866a09d070d2fb472e956ca7297c4c5b"/><file name="TransController.php" hash="c618911e26a91a9c38462a1e351455d7"/><file name="UploadController.php" hash="d54ce2272adff428fa8d642fba0da061"/></dir><dir name="data"><dir name="webtoprint_setup"><file name="data-upgrade-12-13.php" hash="bf11fb84b8dc29978edf2dde76fcfc94"/></dir></dir><dir name="etc"><file name="config.xml" hash="1da1620ac86dea2acbae931841b48b5a"/><file name="custom-options.xsd" hash="08b1f468c2583eb8934a4a45d8ab4bc7"/><file name="system.xml" hash="3f0ff1539b115d142b19b71c15e49eb0"/></dir><dir name="sql"><dir name="webtoprint_setup"><file name="mysql4-data-upgrade-8-9.php" hash="232f5a85ee355f215db2b791d3eb5333"/><file name="mysql4-install-1.php" hash="40c5713d5158831cfa4ff927f5789972"/><file name="mysql4-upgrade-1-2.php" hash="15104d010dce29b64048819454970202"/><file name="mysql4-upgrade-10-11.php" hash="77df29e65752035772a9a69cfde3e840"/><file name="mysql4-upgrade-11-12.php" hash="979bbe257a329ce3dc5f6a89f82d0793"/><file name="mysql4-upgrade-2-3.php" hash="e384d9fd053394000a7293048079e4d3"/><file name="mysql4-upgrade-3-4.php" hash="25a6c0fe4e62f230bab357692bbb821d"/><file name="mysql4-upgrade-4-5.php" hash="f8d8c1be5d2b0498815f07249a9b1925"/><file name="mysql4-upgrade-5-6.php" hash="4db08e08cf7e97f82e1e3f76368620f0"/><file name="mysql4-upgrade-6-7.php" hash="89979b5bd55191d63486c2d1c91a25fe"/><file name="mysql4-upgrade-7-8.php" hash="334c3f05c006d92517818c65e34f4132"/><file name="mysql4-upgrade-9-10.php" hash="6ca1534360b029badf0ba2047904ea9f"/><file name="upgrade-13-14.php" hash="d16a06457516183c7bea1cb3d2d43248"/><file name="upgrade-14-15.php" hash="462aa46ea322c7368ae45029d32d0e15"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="zptheme"><dir name="layout"><file name="local.xml" hash="103bcfd7f8971e8c62b453000fab9ade"/></dir><dir name="locale"><dir name="en_US"><file name="translate.csv" hash="36eee9dfc5927ca08aa42132750ba650"/></dir><dir name="ru_RU"><file name="translate.csv" hash="ef3d4b8ea531f9786bf1ac7154838681"/></dir></dir><dir name="template"><dir name="catalog"><dir name="product"><dir name="tab"><dir name="templates"><file name="dynamic-imaging.phtml" hash="943948a5f8868da3c9d273d3038d09a9"/><file name="radiobutton.phtml" hash="fff5ce6ab78a46b098bd8586fdafbd11"/></dir></dir></dir></dir><dir name="sales"><dir name="items"><dir name="column"><file name="name.phtml" hash="600ca19c74d54ccb9a1f809a7e62cf4e"/></dir></dir><dir name="order"><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="ca4857a383df503e5ca668981aa720e7"/></dir></dir><dir name="tab"><file name="info.phtml" hash="0c53a36fd7adaa3111118e76423ae1d9"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="zptheme"><dir name="template"><dir name="callouts"><file name="right_col.phtml" hash="39bc3b7a57363e6c6ec571aa9b5178f2"/></dir><dir name="catalog"><dir name="product"><dir name="view"><file name="addto.phtml" hash="a8137c12717f898bdcf2f697e860fcef"/><file name="addtocart.phtml" hash="3ae47a9d2f53de9626d095652803d12d"/><file name="media.phtml" hash="2eb7d8b00c8a8008497586d2410cc593"/></dir><file name="view.phtml" hash="51100bb10566d9b7dcbaaa1035ed99d3"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="6e4da8dc072dcc7315f1deef7703187d"/></dir></dir></dir><dir name="sales"><dir name="order"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="1d8b00c20064b5225d5107108b7fdeeb"/></dir></dir><file name="items.phtml" hash="a70c5c748935ee6b6c5cce224f6c0a93"/></dir></dir><dir name="wishlist"><dir name="item"><dir name="column"><file name="image.phtml" hash="22f463bd042e698061ca18f1b91c51df"/></dir></dir></dir></dir></dir><dir name="zp2steptheme"><dir name="template"><dir name="catalog"><dir name="product"><dir name="view"><file name="addto.phtml" hash="f7382ad4dadcf81867518d345b19c4ce"/><file name="addtocart.phtml" hash="0187a2fa97020c6e481d34c67373f1d1"/><file name="media.phtml" hash="81f2205b6d9e2606d63efb4dd362b1dc"/></dir><file name="view.phtml" hash="c13f3c2adc29edb47b2498a798008c00"/></dir></dir></dir></dir><dir name="zpadvancedtheme"><dir name="layout"><file name="local.xml" hash="e2c3607469970b8d9d4cc739a1490006"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><dir name="catalog"><file name="web-to-print-product.xml" hash="c608ba223a24171767c25e89ae90c757"/></dir><dir name="checkout"><file name="web-to-print-cart.xml" hash="a59de3a46bbed9a6bec5ad48b6b96873"/></dir><dir name="sales"><file name="web-to-print-order.xml" hash="df0d0d8383d904475ea9d3b6861dbaaf"/></dir><file name="web-to-print.xml" hash="132b692c1e8f740f39289aad4d65eb89"/><dir name="review"><file name="web-to-print-product.xml" hash="c76069cfe20381e7850b6fc397ab67bd"/></dir></dir><dir name="template"><dir name="web-to-print"><dir><dir name="image-edit"><file name="edit.phtml" hash="9b3996baae857506e689ba20e4f8ab9c"/></dir></dir></dir><dir name="catalog"><dir name="product"><dir name="view"><file name="web-to-print-buttons.phtml" hash="3ef671d34a0850a7485ba8200c7d28c7"/></dir></dir></dir><dir name="email"><dir name="order"><dir name="items"><dir name="order"><file name="webtoprint-default.phtml" hash="e97545a10bf772170501eca53ab95c5b"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="zptheme"><dir name="css"><file name="zp-style.css" hash="dcf53adad1e1a72d9580c9b3e10d294f"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="zptheme"><dir name="images"><dir name="media"><file name="get-started.png" hash="e4b8cfcccdf935d27ebc12c5c818b137"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="css"><file name="zp-image-edit.css" hash="decf8f2d7523eda51361ac7a0860b171"/><file name="zp-in-preview-edit.css" hash="a92910e4bb2ee490652cfee76777bb6f"/><file name="zp-style.css" hash="c8ec4ba353899b8f00f0ac2052b9d87e"/></dir><dir name="images"><dir name="image-edit"><file name="crop.png" hash="1932a3ef782c9725582849d50edc61ec"/><file name="delete.png" hash="cae5056aafc123b58a9d7d2f950931ae"/><file name="edit.png" hash="d46e523fb62ddf001e43844a8cad2e7f"/><file name="fit-to-field-crop-icon.png" hash="4903799be782fc6d66ad9be5398e384c"/><file name="flip_h.png" hash="1ac31304ac42e8dee88afe2c3cfd83ab"/><file name="flip_v.png" hash="2a48cc57703943dd1d3d259340a5d251"/><file name="line.png" hash="e29885cc047ef76da85c93b754bee93b"/><file name="move.png" hash="9f5a402dfee964b1bb89b269e2a9844b"/><file name="pen.png" hash="833a24ceae4d60c00d588ed7db36a3b6"/><file name="resize.png" hash="2e9e5a5008dceffaeb5d79f7bf2b6dfd"/><file name="restore.png" hash="c7730035aee2f868291bbcc82e7daef3"/><file name="rotate_l.png" hash="ae3b9fac8b2376ff20420dcc19ec2d8b"/><file name="rotate_r.png" hash="9053177817d8890bf72290320579fe38"/><file name="status-bar-sprite.png" hash="e6f5b566176ee6a53ef2e5b67b1c3055"/></dir><file name="big-spinner.gif" hash="da798def57c4b5fed4274c11df85e332"/><file name="edited-shape-background.png" hash="061eefe277c498225640d2bc8100c51b"/><file name="images-selector-sprites.png" hash="d0cec2fbb7e1fe66c928dd9067295387"/><file name="in-preview-edit-sprite.png" hash="1f695b3d738973910c1b6a074c9e33e7"/><file name="spinner.gif" hash="541f417381a25b27a0a3e8c048bc652d"/><file name="transparent-background.gif" hash="bbfd7b49dc892a72a8a87d8d1ae3e4ee"/><file name="page-size-icon.png" hash="113320bc626ce10787fd2d7d605973d9"/><file name="zp-image-edit-sprite.png" hash="905bbe3492ea780a73abe207161421a4"/><dir name="web-to-print"><file name="loading-spinner.gif" hash="4bba752c92dcc06ba42ebcf4f95617ca"/><file name="preview-overlay-background.png" hash="97c0267aa2b85879c7c21d89e7a04e47"/><file name="zp-button-background.png" hash="263db20821d062f6a76b4b05d2218efa"/><file name="zp-button-sprites.png" hash="f7a420e549146f606268bf166d044154"/></dir></dir><dir name="js"><file name="zp-image-edit.js" hash="cb70e1fee6e2e2085d88c164cfeca8eb"/><file name="zp-in-preview-edit.js" hash="78cc62b9cd8543484cc542c26f1eba77"/><file name="zp-personalization-form.js" hash="82c36351a08d68af72dc51584fb436ea"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="bg_BG"><file name="ZetaPrints_WebToPrint.csv" hash="944fa2d2777098aaf2a3193194f1fcfd"/></dir><dir name="en_US"><file name="ZetaPrints_WebToPrint.csv" hash="003d60eb82817b8313a8baf390d3ca78"/></dir><dir name="es_ES"><file name="ZetaPrints_WebToPrint.csv" hash="432806dca0c769690e6be87778da299c"/></dir><dir name="ru_RU"><file name="ZetaPrints_WebToPrint.csv" hash="abc4592eac42e65bba71001dff5669d3"/></dir><dir name="de_DE"><file name="ZetaPrints_WebToPrint.csv" hash="d1c6f6d8d700345172ad1d3c8ca527f2"/></dir><dir name="mk_MK"><file name="ZetaPrints_WebToPrint.csv" hash="35cd58dde2b3a4d575b5c7d8439db48e"/></dir><dir name="nl_NL"><file name="ZetaPrints_WebToPrint.csv" hash="c1ad22876a1fa6b6eb70b69f20b79822"/></dir><dir name="tr_TR"><file name="ZetaPrints_WebToPrint.csv" hash="37e4d625f2481ba781c39027b3790010"/></dir></target><target name="mageweb"><dir name="js"><dir name="colorpicker"><file name="colorpicker.css" hash="d903ee19004f9cb287d38028836148b9"/><file name="colorpicker.js" hash="65cd976b4d3d7bf7073ea10773f5c574"/><dir name="images"><file name="blank.gif" hash="56398e76be6355ad5999b262208a17c9"/><file name="colorpicker_background.png" hash="a79f1a2a81bfe3ed1c2ca4c41b8e1fbf"/><file name="colorpicker_hex.png" hash="16d6870c36e379c06fb26ebd2e16bf44"/><file name="colorpicker_hsb_b.png" hash="2be4e81b4a5c98674abe6fc60b447e9a"/><file name="colorpicker_hsb_h.png" hash="d47409a203bedc76b26dc60b71a69f6b"/><file name="colorpicker_hsb_s.png" hash="5ff5e43ab6b7b41b6123bfab692a9b19"/><file name="colorpicker_indic.gif" hash="f485d07540a89502e36dc1a55cec05d0"/><file name="colorpicker_overlay.png" hash="c7a33805ffda0d32bd2a9904c8b02750"/><file name="colorpicker_rgb_b.png" hash="2be4e81b4a5c98674abe6fc60b447e9a"/><file name="colorpicker_rgb_g.png" hash="dc17f953a6febbe174e92b54690586c3"/><file name="colorpicker_rgb_r.png" hash="87eeb205d093b713b68a341771f4ee27"/><file name="colorpicker_select.gif" hash="cec464162af0cce10348e7bb7701ef86"/><file name="colorpicker_submit.png" hash="12d1746e6b52e007f1b78d772d9248ba"/><file name="custom_background.png" hash="06c91f7ae1561ccd8f1c79119529600d"/><file name="custom_hex.png" hash="e27aaa92b15d9392d909f8b94e797524"/><file name="custom_hsb_b.png" hash="b45588ca2fe9ba46673862300fcd3083"/><file name="custom_hsb_h.png" hash="4a1afa5636421aae4c44471d2273496d"/><file name="custom_hsb_s.png" hash="83aa97407fb76615a7db5ed721681148"/><file name="custom_indic.gif" hash="04660eb352eb259581a36a0fe8da2d4d"/><file name="custom_rgb_b.png" hash="f6e50cd567bd3059742d45ab224a413b"/><file name="custom_rgb_g.png" hash="b1e286e06692b3640862a3d07f636a80"/><file name="custom_rgb_r.png" hash="8ae4b3ef109ee66ec1022632470ddd0f"/><file name="custom_submit.png" hash="35423f0f2538e507dec193b52f8d0327"/><file name="select.png" hash="7b086953a8c62d2685a65644979d5d04"/><file name="select2.png" hash="c8d194d92dbad98615b2a9140b34ab48"/><file name="slider.png" hash="3a50b8078dea50b9811603a85ecef836"/></dir></dir><dir name="fancybox"><file name="fancybox-resizing.css" hash="873d5f5c826b73e6b75844ed4062744f"/><file name="fancybox-resizing.js" hash="e37b00db53132217e965427058dec7eb"/><file name="fancybox-save-image.css" hash="9d8be052aaa7cc0971dbd514a515d509"/><file name="fancybox-save-image.js" hash="e89e092715bc3df2042259398d55fcc5"/><file name="fancybox-select-image.css" hash="aed8d9d2efa9c3d99b907ed1370766c3"/><file name="fancybox-select-image.js" hash="67bfb4f019e9a87ec614941fae20d393"/><file name="fancybox-update-preview.css" hash="7a6965d53545cf4bdf27aed5b56573bc"/><file name="fancybox-update-preview.js" hash="63d89cf88fa1fd860f5dcb773537529f"/><dir name="images"><file name="blank.gif" hash="325472601571f31e1bf00674c368d335"/><file name="fancy_close.png" hash="6e2879a324a76e9972ebc98201aae1d8"/><file name="fancy_loading.png" hash="b1d54c240cf06e7f41e372d56919b738"/><file name="fancy_nav_left.png" hash="3f3e406102152cd8236383568a40ba35"/><file name="fancy_nav_right.png" hash="216e4bde5bddeeaa60dc3d692890a68e"/><file name="fancy_shadow_e.png" hash="fd4f491080d29fade5080877f1ba4c8b"/><file name="fancy_shadow_n.png" hash="18cde16379b2ceadef714d9b346d09ec"/><file name="fancy_shadow_ne.png" hash="63adf788acf193d4e4f3642d7d793125"/><file name="fancy_shadow_nw.png" hash="c820c878aedb7a7f9ebd7135a58e7c65"/><file name="fancy_shadow_s.png" hash="9b9e5c888028aaef40fe5b6a363f1e29"/><file name="fancy_shadow_se.png" hash="a8afd5a008884380ee712d177105268f"/><file name="fancy_shadow_sw.png" hash="f81cc0fee5581d76ad3cebe47e7e791b"/><file name="fancy_shadow_w.png" hash="59b0e63eb059e58d932cfd53da4d87e6"/><file name="fancy_title_left.png" hash="1582ac2d3bef6a6445bf02ceca2741cd"/><file name="fancy_title_main.png" hash="38dad6c1ed4bdc81c0bec721b2deb8c2"/><file name="fancy_title_over.png" hash="b886fd165d4b7ac77d41fb52d87ffc60"/><file name="fancy_title_right.png" hash="6cbe0c935511e7f9a2555ccb6a7324c4"/><file name="fancybox-x.png" hash="168696d8a694214090ef90e029cdf393"/><file name="fancybox-y.png" hash="36a58859beb9a6b19322a37466b9f78e"/><file name="fancybox.png" hash="943455e2f07f74204ad982304a4cbb27"/><file name="zp-update-preview-button-rotating-arrows.gif" hash="717e17df98dd44ca7745e81fd4373976"/><file name="zp-update-preview-button-sprite.png" hash="c940eeaab267ee1c9b7cfd79ab57e458"/><file name="zp-update-preview-button-x.png" hash="286f9e5aa39c7e4ad33a27890c457ab4"/></dir><file name="jquery-fancybox.css" hash="ac26b56d28d1feacf7030a142ad73fff"/><file name="jquery-fancybox.js" hash="c7ab799447eab5a647aca074556f8ac8"/></dir><dir name="jquery"><file name="jquery-min.js" hash="48080a4201448f15d8e72f6786a1e7e7"/><file name="jquery-qtip-min.js" hash="1ba662a8876762876602e10882d12d2c"/><file name="jquery-ui-custom-min.js" hash="a6ebf059fed4c48f796f55acfdbf1436"/></dir><dir name="lib"><file name="ajaxupload.js" hash="ad9135b2a5aa39fefffe257e5fb8f11c"/></dir><dir name="powercrop"><dir name="images"><file name="cursor-move.png" hash="350c09c97b9e1a2035112a140636b0a4"/></dir><file name="jquery-powercrop.css" hash="fb2e83acc6d3a46a408db21398900948"/><file name="jquery-powercrop.js" hash="f9943f0679d963aa7188ba4e271df8b6"/></dir><dir name="zetaprints"><dir name="images"><dir name="zp-combobox-field"><file name="sprites.gif" hash="9c4e000f0cc9fcecaca754f4a95deedf"/></dir><dir name="zp-text-field-editor"><file name="sprites.png" hash="5963823e045d8fbca649a783b9979517"/></dir><dir name="zp-text-field-resizer"><file name="left-handle.gif" hash="14e1072668649893740c5434f8b35a16"/><file name="right-handle.gif" hash="fb7954ef560ab5db4addd015739008fc"/></dir></dir><file name="zp-combobox-field.css" hash="100156d71b72b536dbd7822dfd985f42"/><file name="zp-combobox-field.js" hash="222f5d3752104ba8b14d641b8ae8a3b6"/><file name="zp-dataset.css" hash="37b7adf2ac746ddbe53913bb0b34ba67"/><file name="zp-dataset.js" hash="d658a5c2494fc9848474699b93219960"/><file name="zp-metadata.js" hash="d0749f2c3ede0443951438627d7b5f97"/><file name="zp-text-field-editor.css" hash="fc7e89e26fcc4bccd4c37060df3debab"/><file name="zp-text-field-editor.js" hash="50c23e8ecf122a4d5ccffadfa7c2ddf1"/><file name="zp-text-field-resizer.js" hash="bec48882f2e5ad0429067409e526cfdb"/></dir></dir></target><target name="magelib"><dir name="ZetaPrints"><file name="Api.php" hash="9b84afe36689561daaf4ec82df1c62e4"/><file name="mage-logging.php" hash="cccf6f2896d6bdc5eaa71d74fa1cdf36"/><dir name="xslt"><file name="common-templates.xslt" hash="98a35be3b523723c2367ead7d045f01f"/><file name="image-fields.xslt" hash="2805edeb2950fdba13ebce13f865f01d"/><file name="page-size-table.xslt" hash="fdb521ec348fd82105fc66eb7b9db952"/><file name="page-tabs.xslt" hash="e341e7a708af01b5ac0b7792b0067e2b"/><file name="text-fields.xslt" hash="a6f8f17499c746e9a85cf9c58e40cbe3"/></dir><file name="zetaprints-api.php" hash="88858ea5e789907cf0a2f09b3fd6fb68"/></dir></target></contents>
38
  <compatible/>
39
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>curl</name><min/><max/></extension><extension><name>xsl</name><min/><max/></extension></required></dependencies>
40
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>web_to_print_store_incl_theme</name>
4
+ <version>2.3.0.0</version>
5
  <stability>stable</stability>
6
  <license>mixed</license>
7
  <channel>community</channel>
21
  &#xD;
22
  Technical support: admin@zetaprints.com&#xD;
23
  Extension developed by http://www.zetaprints.com/</description>
24
+ <notes>* Synchronise with Magento 1.9.0.2&#xD;
25
+ * Remove support for Magento releases older than 1.6&#xD;
26
+ * Improvements in 2-step theme&#xD;
27
+ * Other small bug fixes and improvements&#xD;
28
+ &#xD;
29
+ NOTE: this release doesn't support new RWD theme out of the box</notes>
 
 
 
 
30
  <authors><author><name>Anatoly A. Kazantsev</name><user>jimcrow</user><email>anatoly@zetaprints.com</email></author></authors>
31
+ <date>2014-11-10</date>
32
+ <time>19:04:03</time>
33
+ <contents><target name="mageetc"><dir name="modules"><file name="ZetaPrints_WebToPrint.xml" hash="4690d74c958173f35baddabde4276cf4"/></dir></target><target name="magecommunity"><dir name="ZetaPrints"><dir name="WebToPrint"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><dir name="Templates"><file name="Dynamicimaging.php" hash="507a4c9dd7ebb3cca626ee37094d213e"/><file name="Radiobutton.php" hash="c1a1afb50b857211ce79dd2850f514f1"/></dir><file name="Templates.php" hash="3b5b8cb346bfdf3420ae1026034cd225"/></dir></dir></dir></dir><dir name="Customer"><file name="Sidebar.php" hash="91b271b4a80199d6aa9c048e2c89e623"/><dir name="Wishlist"><dir name="Item"><dir name="Column"><file name="Comment.php" hash="efc441b7489cc940503fe5b33db09e41"/></dir></dir></dir></dir><dir name="Html"><file name="Footer.php" hash="498b6b9b51032e1f8f64789a665c744b"/></dir></dir><dir name="Helper"><file name="2step.php" hash="ddda69f72db7a49957a0bbb2be700b70"/><file name="Category.php" hash="e20ea5876c1d3948ee814f27ff90e6d5"/><file name="Data.php" hash="45e252c5076044eaa61b9ff3c398aa8a"/><file name="PersonalizationForm.php" hash="7bafca290a577976ebb31f8fe7ab327e"/></dir><dir name="Model"><file name="Config.php" hash="460c0632326e33b75bfe5d48fb05043c"/><dir name="Convert"><dir name="Mapper"><dir name="Product"><file name="Creating.php" hash="419502356b0a2cb384eccc37f77a1cbd"/><file name="Updating.php" hash="7ec4266c2f8d6c8ca7c96c5397a616ae"/></dir></dir><dir name="Parser"><file name="Catalogue.php" hash="219764bb39f9ad8711135e61113c83d1"/><file name="Template.php" hash="c2fa53784963b7596f118636ef3dd978"/></dir></dir><dir name="Events"><file name="Observer.php" hash="3f58696f7a49802b62ab1567c4d64aa4"/></dir><file name="Item.php" hash="1c50ac1a3463b7030a572657223fa4cd"/><dir name="Quote"><file name="Item.php" hash="1f12b610013de10184177dc6a89a0d41"/></dir><dir name="Resource"><file name="Setup.php" hash="1e415970f4ecf42b20d7f0ee18363adb"/><dir name="Template"><file name="Collection.php" hash="c0469f86815f395f33028dca3456257d"/></dir><file name="Template.php" hash="82b24eb29c98ec58de75894826ae4b66"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Apikey.php" hash="089da852bd20b5fe579eef455a8404df"/><file name="FileUploadingLimit.php" hash="dcaf5a851a8d36f6ab09d65a2626b006"/><file name="ZetaPrintsUrl.php" hash="3716c4522ca04d64fd2d15b41d529152"/></dir><dir name="Source"><file name="TemplateDeletingBehaviour.php" hash="232bec5c787c616f0740297b464f737e"/></dir></dir></dir><file name="Template.php" hash="29a7e3dbecd238b05796db54a37bd622"/></dir><dir name="controllers"><dir name="Catalog"><file name="ProductController.php" hash="206b85ba57d4d6fd34bbf085e886e307"/></dir><file name="ImageController.php" hash="2058309a6b2572c2bce2c32e20851167"/><file name="OrderController.php" hash="af6fbe14a33c73d0c2357cd0483e20f0"/><file name="PhotothumbnailController.php" hash="3d5eb2626773886be58c83f11efadbe2"/><file name="PreviewController.php" hash="de28d77b356f24feaf1099c9b8b39416"/><file name="ThumbnailController.php" hash="866a09d070d2fb472e956ca7297c4c5b"/><file name="TransController.php" hash="c618911e26a91a9c38462a1e351455d7"/><file name="UploadController.php" hash="d54ce2272adff428fa8d642fba0da061"/></dir><dir name="data"><dir name="webtoprint_setup"><file name="data-upgrade-12-13.php" hash="bf11fb84b8dc29978edf2dde76fcfc94"/></dir></dir><dir name="etc"><file name="config.xml" hash="f9edc21e762139601e533ee88cf3f1f1"/><file name="custom-options.xsd" hash="08b1f468c2583eb8934a4a45d8ab4bc7"/><file name="system.xml" hash="3f0ff1539b115d142b19b71c15e49eb0"/></dir><dir name="sql"><dir name="webtoprint_setup"><file name="mysql4-data-upgrade-8-9.php" hash="232f5a85ee355f215db2b791d3eb5333"/><file name="mysql4-install-1.php" hash="40c5713d5158831cfa4ff927f5789972"/><file name="mysql4-upgrade-1-2.php" hash="15104d010dce29b64048819454970202"/><file name="mysql4-upgrade-10-11.php" hash="77df29e65752035772a9a69cfde3e840"/><file name="mysql4-upgrade-11-12.php" hash="979bbe257a329ce3dc5f6a89f82d0793"/><file name="mysql4-upgrade-2-3.php" hash="e384d9fd053394000a7293048079e4d3"/><file name="mysql4-upgrade-3-4.php" hash="25a6c0fe4e62f230bab357692bbb821d"/><file name="mysql4-upgrade-4-5.php" hash="f8d8c1be5d2b0498815f07249a9b1925"/><file name="mysql4-upgrade-5-6.php" hash="4db08e08cf7e97f82e1e3f76368620f0"/><file name="mysql4-upgrade-6-7.php" hash="89979b5bd55191d63486c2d1c91a25fe"/><file name="mysql4-upgrade-7-8.php" hash="334c3f05c006d92517818c65e34f4132"/><file name="mysql4-upgrade-9-10.php" hash="6ca1534360b029badf0ba2047904ea9f"/><file name="upgrade-13-14.php" hash="d16a06457516183c7bea1cb3d2d43248"/><file name="upgrade-14-15.php" hash="462aa46ea322c7368ae45029d32d0e15"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="zptheme"><dir name="layout"><file name="local.xml" hash="103bcfd7f8971e8c62b453000fab9ade"/></dir><dir name="locale"><dir name="en_US"><file name="translate.csv" hash="36eee9dfc5927ca08aa42132750ba650"/></dir><dir name="ru_RU"><file name="translate.csv" hash="ef3d4b8ea531f9786bf1ac7154838681"/></dir></dir><dir name="template"><dir name="catalog"><dir name="product"><dir name="tab"><dir name="templates"><file name="dynamic-imaging.phtml" hash="943948a5f8868da3c9d273d3038d09a9"/><file name="radiobutton.phtml" hash="fff5ce6ab78a46b098bd8586fdafbd11"/></dir></dir></dir></dir><dir name="sales"><dir name="items"><dir name="column"><file name="name.phtml" hash="600ca19c74d54ccb9a1f809a7e62cf4e"/></dir></dir><dir name="order"><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="ca4857a383df503e5ca668981aa720e7"/></dir></dir><dir name="tab"><file name="info.phtml" hash="0c53a36fd7adaa3111118e76423ae1d9"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="zptheme"><dir name="etc"><file name="theme.xml" hash="650fd16718f951c63780a0a321b2f758"/></dir><dir name="template"><dir name="callouts"><file name="right_col.phtml" hash="39bc3b7a57363e6c6ec571aa9b5178f2"/></dir><dir name="catalog"><dir name="product"><dir name="view"><file name="addto.phtml" hash="1fbad5a7c20190694f138929320faa7e"/><file name="addtocart.phtml" hash="72f77d7cb50e16518e4c270692545234"/><file name="media.phtml" hash="60a8bc96079831e04be5abc3948aa9e7"/></dir><file name="view.phtml" hash="65cbc6b911b7081ea12b0169ee8825b0"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="89a9d24568b80cb014adcef637d97438"/></dir></dir></dir><dir name="sales"><dir name="order"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="81c9a4e904d27150608e5adc0930ce0a"/></dir></dir><file name="items.phtml" hash="c014c9f255676b1c011ae39e8ea84c2b"/></dir></dir><dir name="wishlist"><dir name="item"><dir name="column"><file name="image.phtml" hash="5ead1d6ed8ccc473874ab5fbb008c855"/></dir></dir></dir></dir></dir><dir name="zp2steptheme"><dir name="etc"><file name="theme.xml" hash="286b1d890b8dc354e0420a4d7de7594d"/></dir><dir name="layout"><file name="local.xml" hash="756bd950639879d4a1ea52ec4085a236"/></dir><dir name="template"><dir name="catalog"><dir name="product"><dir name="view"><file name="addto.phtml" hash="56a102ed9781ca2b8cb9b5a66bc22159"/><file name="addtocart.phtml" hash="ab1c30ca4671e3eb37263424f889d019"/><file name="media.phtml" hash="5f37f29c60778fb72a9d5f2ffee8e69e"/></dir><file name="view.phtml" hash="b2e5373ea2234b65935b8908a8349151"/></dir></dir></dir></dir><dir name="zpadvancedtheme"><dir name="layout"><file name="local.xml" hash="e2c3607469970b8d9d4cc739a1490006"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><dir name="catalog"><file name="web-to-print-product.xml" hash="b604ec18daa467d47b947521352271d8"/></dir><dir name="checkout"><file name="web-to-print-cart.xml" hash="a59de3a46bbed9a6bec5ad48b6b96873"/></dir><dir name="sales"><file name="web-to-print-order.xml" hash="df0d0d8383d904475ea9d3b6861dbaaf"/></dir><file name="web-to-print.xml" hash="132b692c1e8f740f39289aad4d65eb89"/><dir name="review"><file name="web-to-print-product.xml" hash="c76069cfe20381e7850b6fc397ab67bd"/></dir></dir><dir name="template"><dir name="web-to-print"><dir><dir name="image-edit"><file name="edit.phtml" hash="9b3996baae857506e689ba20e4f8ab9c"/></dir></dir></dir><dir name="catalog"><dir name="product"><dir name="view"><file name="web-to-print-buttons.phtml" hash="3ef671d34a0850a7485ba8200c7d28c7"/></dir></dir></dir><dir name="email"><dir name="order"><dir name="items"><dir name="order"><file name="webtoprint-default.phtml" hash="e97545a10bf772170501eca53ab95c5b"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="zptheme"><dir name="css"><file name="zp-style.css" hash="dcf53adad1e1a72d9580c9b3e10d294f"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="zptheme"><dir name="images"><dir name="media"><file name="get-started.png" hash="e4b8cfcccdf935d27ebc12c5c818b137"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="css"><file name="zp-image-edit.css" hash="decf8f2d7523eda51361ac7a0860b171"/><file name="zp-in-preview-edit.css" hash="a92910e4bb2ee490652cfee76777bb6f"/><file name="zp-style.css" hash="b722726424180f1f4a8e51e167c34675"/></dir><dir name="images"><dir name="image-edit"><file name="crop.png" hash="1932a3ef782c9725582849d50edc61ec"/><file name="delete.png" hash="cae5056aafc123b58a9d7d2f950931ae"/><file name="edit.png" hash="d46e523fb62ddf001e43844a8cad2e7f"/><file name="fit-to-field-crop-icon.png" hash="4903799be782fc6d66ad9be5398e384c"/><file name="flip_h.png" hash="1ac31304ac42e8dee88afe2c3cfd83ab"/><file name="flip_v.png" hash="2a48cc57703943dd1d3d259340a5d251"/><file name="line.png" hash="e29885cc047ef76da85c93b754bee93b"/><file name="move.png" hash="9f5a402dfee964b1bb89b269e2a9844b"/><file name="pen.png" hash="833a24ceae4d60c00d588ed7db36a3b6"/><file name="resize.png" hash="2e9e5a5008dceffaeb5d79f7bf2b6dfd"/><file name="restore.png" hash="c7730035aee2f868291bbcc82e7daef3"/><file name="rotate_l.png" hash="ae3b9fac8b2376ff20420dcc19ec2d8b"/><file name="rotate_r.png" hash="9053177817d8890bf72290320579fe38"/><file name="status-bar-sprite.png" hash="e6f5b566176ee6a53ef2e5b67b1c3055"/></dir><file name="big-spinner.gif" hash="da798def57c4b5fed4274c11df85e332"/><file name="edited-shape-background.png" hash="061eefe277c498225640d2bc8100c51b"/><file name="images-selector-sprites.png" hash="d0cec2fbb7e1fe66c928dd9067295387"/><file name="in-preview-edit-sprite.png" hash="1f695b3d738973910c1b6a074c9e33e7"/><file name="spinner.gif" hash="541f417381a25b27a0a3e8c048bc652d"/><file name="transparent-background.gif" hash="bbfd7b49dc892a72a8a87d8d1ae3e4ee"/><file name="page-size-icon.png" hash="113320bc626ce10787fd2d7d605973d9"/><file name="zp-image-edit-sprite.png" hash="905bbe3492ea780a73abe207161421a4"/><dir name="web-to-print"><file name="loading-spinner.gif" hash="4bba752c92dcc06ba42ebcf4f95617ca"/><file name="preview-overlay-background.png" hash="97c0267aa2b85879c7c21d89e7a04e47"/><file name="zp-button-background.png" hash="263db20821d062f6a76b4b05d2218efa"/><file name="zp-button-sprites.png" hash="f7a420e549146f606268bf166d044154"/></dir></dir><dir name="js"><file name="zp-image-edit.js" hash="cb70e1fee6e2e2085d88c164cfeca8eb"/><file name="zp-in-preview-edit.js" hash="0d05b23befd1e98976e04b9363318045"/><file name="zp-personalization-form.js" hash="49a32501f1ff67f31479154fd95ef129"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="bg_BG"><file name="ZetaPrints_WebToPrint.csv" hash="944fa2d2777098aaf2a3193194f1fcfd"/></dir><dir name="en_US"><file name="ZetaPrints_WebToPrint.csv" hash="003d60eb82817b8313a8baf390d3ca78"/></dir><dir name="es_ES"><file name="ZetaPrints_WebToPrint.csv" hash="432806dca0c769690e6be87778da299c"/></dir><dir name="ru_RU"><file name="ZetaPrints_WebToPrint.csv" hash="abc4592eac42e65bba71001dff5669d3"/></dir><dir name="de_DE"><file name="ZetaPrints_WebToPrint.csv" hash="d1c6f6d8d700345172ad1d3c8ca527f2"/></dir><dir name="mk_MK"><file name="ZetaPrints_WebToPrint.csv" hash="35cd58dde2b3a4d575b5c7d8439db48e"/></dir><dir name="nl_NL"><file name="ZetaPrints_WebToPrint.csv" hash="c1ad22876a1fa6b6eb70b69f20b79822"/></dir><dir name="tr_TR"><file name="ZetaPrints_WebToPrint.csv" hash="37e4d625f2481ba781c39027b3790010"/></dir></target><target name="mageweb"><dir name="js"><dir name="fancybox"><file name="fancybox-resizing.css" hash="873d5f5c826b73e6b75844ed4062744f"/><file name="fancybox-resizing.js" hash="e37b00db53132217e965427058dec7eb"/><file name="fancybox-save-image.css" hash="9d8be052aaa7cc0971dbd514a515d509"/><file name="fancybox-save-image.js" hash="e89e092715bc3df2042259398d55fcc5"/><file name="fancybox-select-image.css" hash="aed8d9d2efa9c3d99b907ed1370766c3"/><file name="fancybox-select-image.js" hash="67bfb4f019e9a87ec614941fae20d393"/><file name="fancybox-update-preview.css" hash="7a6965d53545cf4bdf27aed5b56573bc"/><file name="fancybox-update-preview.js" hash="63d89cf88fa1fd860f5dcb773537529f"/><dir name="images"><file name="blank.gif" hash="325472601571f31e1bf00674c368d335"/><file name="fancy_close.png" hash="6e2879a324a76e9972ebc98201aae1d8"/><file name="fancy_loading.png" hash="b1d54c240cf06e7f41e372d56919b738"/><file name="fancy_nav_left.png" hash="3f3e406102152cd8236383568a40ba35"/><file name="fancy_nav_right.png" hash="216e4bde5bddeeaa60dc3d692890a68e"/><file name="fancy_shadow_e.png" hash="fd4f491080d29fade5080877f1ba4c8b"/><file name="fancy_shadow_n.png" hash="18cde16379b2ceadef714d9b346d09ec"/><file name="fancy_shadow_ne.png" hash="63adf788acf193d4e4f3642d7d793125"/><file name="fancy_shadow_nw.png" hash="c820c878aedb7a7f9ebd7135a58e7c65"/><file name="fancy_shadow_s.png" hash="9b9e5c888028aaef40fe5b6a363f1e29"/><file name="fancy_shadow_se.png" hash="a8afd5a008884380ee712d177105268f"/><file name="fancy_shadow_sw.png" hash="f81cc0fee5581d76ad3cebe47e7e791b"/><file name="fancy_shadow_w.png" hash="59b0e63eb059e58d932cfd53da4d87e6"/><file name="fancy_title_left.png" hash="1582ac2d3bef6a6445bf02ceca2741cd"/><file name="fancy_title_main.png" hash="38dad6c1ed4bdc81c0bec721b2deb8c2"/><file name="fancy_title_over.png" hash="b886fd165d4b7ac77d41fb52d87ffc60"/><file name="fancy_title_right.png" hash="6cbe0c935511e7f9a2555ccb6a7324c4"/><file name="fancybox-x.png" hash="168696d8a694214090ef90e029cdf393"/><file name="fancybox-y.png" hash="36a58859beb9a6b19322a37466b9f78e"/><file name="fancybox.png" hash="943455e2f07f74204ad982304a4cbb27"/><file name="zp-update-preview-button-rotating-arrows.gif" hash="717e17df98dd44ca7745e81fd4373976"/><file name="zp-update-preview-button-sprite.png" hash="c940eeaab267ee1c9b7cfd79ab57e458"/><file name="zp-update-preview-button-x.png" hash="286f9e5aa39c7e4ad33a27890c457ab4"/></dir><file name="jquery-fancybox.css" hash="ac26b56d28d1feacf7030a142ad73fff"/><file name="jquery-fancybox.js" hash="c7ab799447eab5a647aca074556f8ac8"/></dir><dir name="jquery"><file name="jquery-min.js" hash="48080a4201448f15d8e72f6786a1e7e7"/><file name="jquery-qtip-min.js" hash="1ba662a8876762876602e10882d12d2c"/><file name="jquery-ui-custom-min.js" hash="ecce1b14cfd817e608f6be7202c153ae"/></dir><dir name="lib"><file name="ajaxupload.js" hash="ad9135b2a5aa39fefffe257e5fb8f11c"/></dir><dir name="powercrop"><dir name="images"><file name="cursor-move.png" hash="350c09c97b9e1a2035112a140636b0a4"/></dir><file name="jquery-powercrop.css" hash="fb2e83acc6d3a46a408db21398900948"/><file name="jquery-powercrop.js" hash="f9943f0679d963aa7188ba4e271df8b6"/></dir><dir name="zetaprints"><dir name="colorpicker"><file name="colorpicker.css" hash="0dbc42155bba078c57e86d9d62e99551"/><file name="colorpicker.js" hash="d9dd0ca39481ab02115d498717fba50c"/><dir name="images"><dir name="128"><file name="bar-alpha.png" hash="e7c5c2de7c796c7779aad361a4cbc584"/><file name="bar.png" hash="0b2c5541377958dbeaf5c5df0c800aa1"/><file name="map.png" hash="83d12293b9cd75385755e8062879e66e"/></dir><file name="bar-alpha.png" hash="5c5791930e0644f718c68296a62251cd"/><file name="bar-opacity.png" hash="ca51657e035c8ec7101a2ba3e4fb027c"/><file name="bar-pointer.png" hash="5fd83de4556ee0a6c2421cf4a82b33ff"/><file name="bar.png" hash="fe1c7cbad0cbc0e2d90a0291658dbbcb"/><file name="map-opacity.png" hash="47d63ecea460265f78ab03b88d2b0b10"/><file name="map-pointer.png" hash="e980c6080dd47664329b219cc35cd79d"/><file name="map.png" hash="db163b6d98c20097ec791f4d7dd938fd"/><file name="preview-opacity.png" hash="ab27137e3f7161c011a7b8bb89782c73"/><file name="ui-colorpicker.png" hash="7f84e7fc66ed39527a51c97ce1e181f0"/></dir><file name="switcher.js" hash="21f0352291054cb758596bc9bf2c451e"/></dir><dir name="images"><dir name="zp-combobox-field"><file name="sprites.gif" hash="9c4e000f0cc9fcecaca754f4a95deedf"/></dir><dir name="zp-text-field-editor"><file name="sprites.png" hash="5963823e045d8fbca649a783b9979517"/></dir><dir name="zp-text-field-resizer"><file name="left-handle.gif" hash="14e1072668649893740c5434f8b35a16"/><file name="right-handle.gif" hash="fb7954ef560ab5db4addd015739008fc"/></dir></dir><file name="zp-combobox-field.css" hash="100156d71b72b536dbd7822dfd985f42"/><file name="zp-combobox-field.js" hash="222f5d3752104ba8b14d641b8ae8a3b6"/><file name="zp-dataset.css" hash="37b7adf2ac746ddbe53913bb0b34ba67"/><file name="zp-dataset.js" hash="d658a5c2494fc9848474699b93219960"/><file name="zp-metadata.js" hash="d0749f2c3ede0443951438627d7b5f97"/><file name="zp-text-field-editor.css" hash="fc7e89e26fcc4bccd4c37060df3debab"/><file name="zp-text-field-editor.js" hash="2e1268d78c1bf30c2cd68379a76786d6"/><file name="zp-text-field-resizer.js" hash="bec48882f2e5ad0429067409e526cfdb"/></dir></dir></target><target name="magelib"><dir name="ZetaPrints"><file name="Api.php" hash="9b84afe36689561daaf4ec82df1c62e4"/><file name="mage-logging.php" hash="cccf6f2896d6bdc5eaa71d74fa1cdf36"/><dir name="xslt"><file name="common-templates.xslt" hash="98a35be3b523723c2367ead7d045f01f"/><file name="image-fields.xslt" hash="2805edeb2950fdba13ebce13f865f01d"/><file name="page-size-table.xslt" hash="fdb521ec348fd82105fc66eb7b9db952"/><file name="page-tabs.xslt" hash="e341e7a708af01b5ac0b7792b0067e2b"/><file name="text-fields.xslt" hash="a6f8f17499c746e9a85cf9c58e40cbe3"/></dir><file name="zetaprints-api.php" hash="88858ea5e789907cf0a2f09b3fd6fb68"/></dir></target></contents>
34
  <compatible/>
35
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max/></package><extension><name>curl</name><min/><max/></extension><extension><name>xsl</name><min/><max/></extension></required></dependencies>
36
  </package>
skin/frontend/base/default/css/zp-style.css CHANGED
@@ -1031,3 +1031,135 @@ div.zetaprints-buttons-row div.row-part.first .zetaprints-button {
1031
  .zp-html-template {
1032
  display: none;
1033
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1031
  .zp-html-template {
1032
  display: none;
1033
  }
1034
+
1035
+ /* Color picker */
1036
+ .ui-colorpicker {
1037
+ background: linear-gradient(to bottom, #525252, #121212 30px);
1038
+ border-radius: 4px;
1039
+ overflow: hidden;
1040
+ padding: 0px 5px 5px;
1041
+ position: absolute;
1042
+ z-index: 11000 !important;
1043
+ }
1044
+
1045
+ .ui-dialog-titlebar {
1046
+ cursor: move;
1047
+ height: 22px;
1048
+ margin: 0 -5px;
1049
+ }
1050
+
1051
+ .ui-colorpicker-border {
1052
+ border: 2px solid #484848;
1053
+ border-radius: 2px;
1054
+ }
1055
+
1056
+ .ui-colorpicker-preview {
1057
+ background: #fff;
1058
+ }
1059
+
1060
+ .ui-colorpicker-preview-initial,
1061
+ .ui-colorpicker-preview-current {
1062
+ width: 44px;
1063
+ }
1064
+
1065
+ .ui-colorpicker-hex-container {
1066
+ float: right;
1067
+ padding: 1px 1px 0 0;
1068
+ }
1069
+
1070
+ .ui-colorpicker-number,
1071
+ .ui-colorpicker-hex-input {
1072
+ border: 2px solid #484848;
1073
+ border-radius: 2px;
1074
+ padding: 1px 2px;
1075
+ }
1076
+
1077
+ .ui-colorpicker-number:focus,
1078
+ .ui-colorpicker-hex-input:focus {
1079
+ border-color: #646464;
1080
+ }
1081
+
1082
+ .ui-colorpicker-rgb label,
1083
+ .ui-colorpicker-cmyk label,
1084
+ .ui-colorpicker-hex label,
1085
+ .ui-colorpicker-unit {
1086
+ color: #bfbfbf;
1087
+ text-shadow: 1px 1px #000;
1088
+ }
1089
+
1090
+ .ui-colorpicker-ok,
1091
+ .ui-colorpicker-cancel,
1092
+ .ui-colorpicker-switcher-rgb,
1093
+ .ui-colorpicker-switcher-cmyk {
1094
+ background: transparent;
1095
+ border: 1px solid transparent;
1096
+ color: #BFBFBF;
1097
+ cursor: pointer;
1098
+ font-variant: small-caps;
1099
+ text-shadow: 1px 1px #000;
1100
+ text-transform: lowercase;
1101
+ }
1102
+
1103
+ .ui-colorpicker-ok,
1104
+ .ui-colorpicker-cancel {
1105
+ padding: 4px 4px 0px;
1106
+ }
1107
+
1108
+ .ui-colorpicker-ok {
1109
+ border-radius: 0 0 0 4px;
1110
+ border-right: none;
1111
+ border-top: none;
1112
+ }
1113
+
1114
+ .ui-colorpicker-cancel {
1115
+ border-top: none;
1116
+ border-radius: 0 0 4px 4px;
1117
+ margin: 0 -3px 0 0;
1118
+ }
1119
+
1120
+ .ui-colorpicker-ok:hover,
1121
+ .ui-colorpicker-cancel:hover,
1122
+ .ui-colorpicker-switcher-rgb:hover,
1123
+ .ui-colorpicker-switcher-cmyk:hover,
1124
+ .ui-colorpicker-mode-rgb .ui-colorpicker-switcher-rgb,
1125
+ .ui-colorpicker-mode-cmyk .ui-colorpicker-switcher-cmyk
1126
+ {
1127
+ background: #454545;
1128
+ border-color: #555;
1129
+ color: #f3f3f3;
1130
+ }
1131
+
1132
+ .ui-colorpicker .ui-dialog-buttonpane {
1133
+ position: absolute;
1134
+ right: 0px;
1135
+ top: -1px;
1136
+ }
1137
+
1138
+ .ui-colorpicker-switcher {
1139
+ border-radius: 4px 4px 0 0;
1140
+ height: 18px;
1141
+ left: -5px;
1142
+ overflow: hidden;
1143
+ padding: 4px 0px 0px 12px;
1144
+ position: absolute;
1145
+ top: 0px;
1146
+ }
1147
+
1148
+ .ui-colorpicker-switcher-rgb,
1149
+ .ui-colorpicker-switcher-cmyk {
1150
+ border-bottom: medium none;
1151
+ border-radius: 4px 4px 0px 0px;
1152
+ display: inline-block;
1153
+ padding: 0px 4px;
1154
+ }
1155
+
1156
+ .ui-colorpicker-mode-rgb .ui-colorpicker-cmyk-container,
1157
+ .ui-colorpicker-mode-cmyk .ui-colorpicker-rgb-container,
1158
+ .ui-colorpicker-mode-cmyk .ui-colorpicker-hex-container {
1159
+ display: none;
1160
+ }
1161
+
1162
+ /* Wishlist (default/zptheme specific) */
1163
+ .my-wishlist .product-image.in-dialog {
1164
+ height: auto;
1165
+ }
skin/frontend/base/default/js/zp-in-preview-edit.js CHANGED
@@ -252,6 +252,10 @@ function popup_field_by_name (name, position, selected_shapes) {
252
  show: function (event, ui) {
253
  $panel = jQuery(ui.panel);
254
 
 
 
 
 
255
  var $panel = $panel.find($panel
256
  .find('ul.tab-buttons li.ui-tabs-selected a')
257
  .attr('href') );
@@ -262,7 +266,7 @@ function popup_field_by_name (name, position, selected_shapes) {
262
  zp.show_user_images($panel);
263
  zp.scroll_strip($panel);
264
  zp.show_colorpicker($panel);
265
- }
266
  });
267
  }
268
 
@@ -289,6 +293,14 @@ function popdown_field_by_name (full_name) {
289
  if ($element.hasClass('zetaprints-text-field-wrapper'))
290
  $_element = $element.find('.zetaprints-field');
291
 
 
 
 
 
 
 
 
 
292
  var data = $element.data('in-preview-edit');
293
 
294
  //Remember checked radio button for IE7 workaround
252
  show: function (event, ui) {
253
  $panel = jQuery(ui.panel);
254
 
255
+ //Generate click event on panel to hide opened colorpicker
256
+ //!!!TODO: rework it after upgrading to jQuery UI 1.9+
257
+ $panel.click();
258
+
259
  var $panel = $panel.find($panel
260
  .find('ul.tab-buttons li.ui-tabs-selected a')
261
  .attr('href') );
266
  zp.show_user_images($panel);
267
  zp.scroll_strip($panel);
268
  zp.show_colorpicker($panel);
269
+ },
270
  });
271
  }
272
 
293
  if ($element.hasClass('zetaprints-text-field-wrapper'))
294
  $_element = $element.find('.zetaprints-field');
295
 
296
+ if (jQuery.fn.colorpicker && $element.hasClass('selector-content'))
297
+ $element
298
+ .find('> .tabs-wrapper > .tab')
299
+ .filter('.colour-picker, .color-picker')
300
+ .each(function () {
301
+ zp.hide_colorpicker(jQuery(this));
302
+ });
303
+
304
  var data = $element.data('in-preview-edit');
305
 
306
  //Remember checked radio button for IE7 workaround
skin/frontend/base/default/js/zp-personalization-form.js CHANGED
@@ -287,7 +287,11 @@ function personalization_form ($) {
287
  else
288
  $product_form.addClass('zp-not-modified');
289
 
290
- var $add_to_cart_button = $('#zetaprints-add-to-cart-button');
 
 
 
 
291
 
292
  var $form_button = $('#zp-form-button').click(function () {
293
  var $fields = $('#input-fields-page-' + zp.current_page +
@@ -1091,9 +1095,22 @@ function personalization_form ($) {
1091
  }
1092
 
1093
  zp.show_colorpicker = function ($panel) {
1094
- if (($panel.hasClass('color-picker') || $panel.hasClass('colour-picker'))
1095
- && !$panel.find('input').prop('checked'))
1096
- $panel.find('.color-sample').click();
 
 
 
 
 
 
 
 
 
 
 
 
 
1097
  }
1098
 
1099
  function has_changed_fields_on_page (page_number) {
@@ -1137,7 +1154,7 @@ function personalization_form ($) {
1137
  // shape_handler);
1138
  }
1139
 
1140
- if ($.fn.tabs && $.fn.draggable && $.fn.ColorPicker)
1141
  $('.zetaprints-images-selector').each(function () {
1142
  var $field = $(this);
1143
 
@@ -1165,21 +1182,23 @@ function personalization_form ($) {
1165
  var $panels = $content.find('> .tabs-wrapper > .tab');
1166
 
1167
  $head.click(function () {
 
 
 
 
1168
  if ($field.hasClass('minimized')) {
1169
  $field.removeClass('minimized');
1170
 
1171
- var $panel = $field.hasClass('zetaprints-palette')
1172
- ? $content
1173
- : $panels.not('.ui-tabs-hide');
1174
-
1175
  zp.show_colorpicker($panel);
1176
  scroll_strip($panel)
1177
- }
1178
- else
 
1179
  $field
1180
  .addClass('minimized')
1181
  .removeClass('expanded')
1182
  .css('width', '100%');
 
1183
 
1184
  return false;
1185
  });
@@ -1235,32 +1254,46 @@ function personalization_form ($) {
1235
  $colour_picker_panel
1236
  .find('span > a')
1237
  .click(function () {
1238
- $colour_sample.click();
1239
 
1240
  return false;
1241
  });
1242
 
1243
- $colour_sample.ColorPicker({
1244
- color: '#804080',
1245
- onBeforeShow: function (picker) {
1246
- var colour = $colour_radio_button.val();
1247
-
1248
- if (colour)
1249
- $(this).ColorPickerSetColor(colour);
1250
-
1251
- $(picker).draggable();
 
 
1252
  },
1253
- onSubmit: function (hsb, hex, rgb, picker) {
1254
- $field.removeClass('no-value');
1255
- $colour_sample.css('backgroundColor', '#' + hex);
1256
-
1257
- $colour_radio_button
1258
- .prop('disabled', false)
1259
- .val('#' + hex)
1260
- .change()
1261
- .prop('checked', true);
1262
-
1263
- $(picker).ColorPickerHide();
 
 
 
 
 
 
 
 
 
 
 
 
1264
  }
1265
  });
1266
  });
287
  else
288
  $product_form.addClass('zp-not-modified');
289
 
290
+ //Magento 1.9 and greater adds its own ID
291
+ //Zetaprint's ID is left for compatibility with old installations
292
+ var $add_to_cart_button = $(
293
+ '#product-addtocart-button, #zetaprints-add-to-cart-button'
294
+ );
295
 
296
  var $form_button = $('#zp-form-button').click(function () {
297
  var $fields = $('#input-fields-page-' + zp.current_page +
1095
  }
1096
 
1097
  zp.show_colorpicker = function ($panel) {
1098
+ var $input;
1099
+
1100
+ if (!($panel.hasClass('color-picker') || $panel.hasClass('colour-picker')))
1101
+ return
1102
+
1103
+ $input = $panel.find('input');
1104
+
1105
+ if (!$input.prop('checked'))
1106
+ $input.colorpicker('open');
1107
+ }
1108
+
1109
+ zp.hide_colorpicker = function ($panel) {
1110
+ if ($panel.hasClass('color-picker') || $panel.hasClass('colour-picker'))
1111
+ $panel
1112
+ .find('input')
1113
+ .colorpicker('close', true);
1114
  }
1115
 
1116
  function has_changed_fields_on_page (page_number) {
1154
  // shape_handler);
1155
  }
1156
 
1157
+ if ($.fn.tabs && $.fn.draggable && $.fn.colorpicker)
1158
  $('.zetaprints-images-selector').each(function () {
1159
  var $field = $(this);
1160
 
1182
  var $panels = $content.find('> .tabs-wrapper > .tab');
1183
 
1184
  $head.click(function () {
1185
+ var $panel = $field.hasClass('zetaprints-palette')
1186
+ ? $content
1187
+ : $panels.not('.ui-tabs-hide');
1188
+
1189
  if ($field.hasClass('minimized')) {
1190
  $field.removeClass('minimized');
1191
 
 
 
 
 
1192
  zp.show_colorpicker($panel);
1193
  scroll_strip($panel)
1194
+ } else {
1195
+ zp.hide_colorpicker($panel);
1196
+
1197
  $field
1198
  .addClass('minimized')
1199
  .removeClass('expanded')
1200
  .css('width', '100%');
1201
+ }
1202
 
1203
  return false;
1204
  });
1254
  $colour_picker_panel
1255
  .find('span > a')
1256
  .click(function () {
1257
+ $colour_radio_button.colorpicker('open');
1258
 
1259
  return false;
1260
  });
1261
 
1262
+ $colour_radio_button.colorpicker({
1263
+ color: '804080',
1264
+ inline: false,
1265
+ layout: {
1266
+ //Left, Top, Width, Height (in table cells)
1267
+ map: [0, 0, 1, 5],
1268
+ bar: [1, 0, 1, 5],
1269
+ preview: [2, 0, 1, 1],
1270
+ rgb: [2, 2, 1, 1],
1271
+ hex: [2, 3, 1, 1],
1272
+ cmyk: [3, 2, 1, 2],
1273
  },
1274
+ parts: [
1275
+ 'switcher', 'header', 'map', 'bar', 'hex', 'rgb', 'cmyk', 'preview',
1276
+ 'footer'
1277
+ ],
1278
+ part: {
1279
+ map: { size: 128 },
1280
+ bar: { size: 128 }
1281
+ },
1282
+ altField: $colour_sample,
1283
+ showOn: 'alt',
1284
+ title: ' ',
1285
+ revert: true,
1286
+ showCloseButton: false,
1287
+ colorFormat: ('#HEX'),
1288
+ ok: function (e, data) {
1289
+ if ($colour_radio_button.val()) {
1290
+ $field.removeClass('no-value');
1291
+
1292
+ $colour_radio_button
1293
+ .prop('disabled', false)
1294
+ .change()
1295
+ .prop('checked', true);
1296
+ }
1297
  }
1298
  });
1299
  });