ImageRecycle_image_pdf_optimize - Version 2.0.0

Version Notes

Background optimization
Account creation in plugin

Download this release

Release Info

Developer ImageRecycle
Extension ImageRecycle_image_pdf_optimize
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.0.6 to 2.0.0

Files changed (59) hide show
  1. app/code/community/Imagerecycle/Imagerecycle/Block/Images.php +338 -274
  2. app/code/community/Imagerecycle/Imagerecycle/Block/Notifications.php +18 -0
  3. app/code/community/Imagerecycle/Imagerecycle/Block/Settings.php +66 -0
  4. app/code/community/Imagerecycle/Imagerecycle/Helper/Data.php +114 -23
  5. app/code/community/Imagerecycle/Imagerecycle/Model/Notification.php +21 -0
  6. app/code/community/Imagerecycle/Imagerecycle/Model/Observer.php +196 -69
  7. app/code/community/Imagerecycle/Imagerecycle/Model/Resource/Images.php +5 -5
  8. app/code/community/Imagerecycle/Imagerecycle/Model/Resource/Images/Collection.php +0 -6
  9. app/code/community/Imagerecycle/Imagerecycle/Model/Resource/Setup.php +4 -4
  10. app/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php +270 -220
  11. app/code/community/Imagerecycle/Imagerecycle/controllers/ImageAllController.php +381 -0
  12. app/code/community/Imagerecycle/Imagerecycle/controllers/IndexController.php +317 -166
  13. app/code/community/Imagerecycle/Imagerecycle/etc/adminhtml.xml +14 -14
  14. app/code/community/Imagerecycle/Imagerecycle/etc/config.xml +44 -0
  15. app/code/community/Imagerecycle/Imagerecycle/sql/imagerecycle_setup/mysql4-install-1.0.0.php +20 -18
  16. app/design/adminhtml/default/default/layout/imagerecycle_imagerecycle.xml +40 -12
  17. app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/connect.phtml +70 -0
  18. app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/images.phtml +322 -371
  19. app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/listing.phtml +325 -0
  20. app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/settings.phtml +389 -0
  21. app/etc/modules/Imagerecycle_ImageRecycle.xml +9 -9
  22. js/imagerecycle/imagerecycle/bluebox.js +0 -263
  23. js/imagerecycle/imagerecycle/config.js +199 -0
  24. js/imagerecycle/imagerecycle/jaofiletree.js +210 -0
  25. js/imagerecycle/imagerecycle/jquery.min.js +2 -4
  26. js/imagerecycle/imagerecycle/jquery.reveal.js +160 -0
  27. js/imagerecycle/imagerecycle/script.js +423 -217
  28. js/imagerecycle/imagerecycle/thickbox.js +334 -0
  29. package.xml +14 -12
  30. skin/adminhtml/default/default/imagerecycle/imagerecycle/imagerecycle.css +434 -448
  31. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/application.png +0 -0
  32. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/code.png +0 -0
  33. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/css.png +0 -0
  34. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/db.png +0 -0
  35. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/directory.png +0 -0
  36. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/doc.png +0 -0
  37. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/drive.png +0 -0
  38. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/file.png +0 -0
  39. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/film.png +0 -0
  40. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/flash.png +0 -0
  41. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/folder_open.png +0 -0
  42. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/html.png +0 -0
  43. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/java.png +0 -0
  44. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/linux.png +0 -0
  45. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/loadingAnimation.gif +0 -0
  46. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/music.png +0 -0
  47. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/php.png +0 -0
  48. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/picture.png +0 -0
  49. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/ppt.png +0 -0
  50. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/psd.png +0 -0
  51. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/ruby.png +0 -0
  52. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/script.png +0 -0
  53. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/spinner.gif +0 -0
  54. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/txt.png +0 -0
  55. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/xls.png +0 -0
  56. skin/adminhtml/default/default/imagerecycle/imagerecycle/images/zip.png +0 -0
  57. skin/adminhtml/default/default/imagerecycle/imagerecycle/jaofiletree.css +168 -0
  58. skin/adminhtml/default/default/imagerecycle/imagerecycle/reveal.css +38 -0
  59. skin/adminhtml/default/default/imagerecycle/imagerecycle/thickbox.css +143 -0
app/code/community/Imagerecycle/Imagerecycle/Block/Images.php CHANGED
@@ -1,274 +1,338 @@
1
- <?php
2
-
3
- Class Imagerecycle_Imagerecycle_Block_Images extends Mage_Page_Block_Html {
4
-
5
- private $allowed_ext = array('jpg', 'jpeg', 'png', 'gif','pdf');
6
- private $ignoredPath = array('app', 'var', 'cache', 'adminhtml', '.', '..');
7
- protected $totalImages = 0;
8
- protected $totalFile = 0;
9
- protected $time_elapsed_secs = 0;
10
- protected $totalOptimizedImages = 0;
11
- protected $limit = 30;
12
- protected $page_show = 10;
13
- protected $order_by = '';
14
- protected $order_dir = 'asc';
15
-
16
- public function __construct() {
17
- parent::__construct();
18
- //Include ioaphp class once
19
- include_once(Mage::getModuleDir('', 'Imagerecycle_Imagerecycle') . '/classes/ioa.class.php');
20
- //Get settings
21
- $this->settings = array(
22
- 'api_key' => Mage::getStoreConfig('mageio_api_key'),
23
- 'api_secret' => Mage::getStoreConfig('mageio_api_secret'),
24
- 'installed_time' => Mage::getStoreConfig('mageio_installed_time'),
25
- 'exclude_folders' => Mage::getStoreConfig('mageio_exclude_folders'),
26
- 'resize_auto' => Mage::getStoreConfig('mageio_resize_auto'),
27
- 'resize_image' => Mage::getStoreConfig('mageio_resize_image'),
28
- 'min_size' => Mage::getStoreConfig('mageio_min_size'),
29
- 'max_size' => Mage::getStoreConfig('mageio_max_size'),
30
- 'compression_type_pdf' => Mage::getStoreConfig('mageio_compression_type_pdf'),
31
- 'compression_type_png' => Mage::getStoreConfig('mageio_compression_type_png'),
32
- 'compression_type_jpg' => Mage::getStoreConfig('mageio_compression_type_jpg'),
33
- 'compression_type_gif' => Mage::getStoreConfig('mageio_compression_type_gif'),
34
- 'compression_type' => Mage::getStoreConfig('mageio_compression_type'),
35
- );
36
-
37
- if(empty($this->settings['compression_type']) ) { $this->settings['compression_type'] = 'lossy'; }
38
- if (!empty($this->settings['exclude_folders'])) {
39
- $this->ignoredPath = explode(',',$this->settings['exclude_folders']);
40
- array_unshift($this->ignoredPath, '.');
41
- array_unshift($this->ignoredPath, './');
42
- }else {
43
- $this->settings['exclude_folders'] = "app,var,cache,adminhtml";
44
- }
45
-
46
- for($i=0;$i<count($this->allowed_ext); $i++) {
47
- $compression_type = $this->settings['compression_type_'.$this->allowed_ext[$i]];
48
- if($compression_type=="none") {
49
- unset($this->allowed_ext[$i]);
50
- }
51
- }
52
- $this->allowed_ext = array_values($this->allowed_ext);
53
-
54
- //Get current page
55
- $requestParams = $this->getRequest()->getParams();
56
- $page = !empty($requestParams['page']) ? abs((int) $requestParams['page']) : 1;
57
- $this->page = $page;
58
- }
59
-
60
- public function getImages() {
61
-
62
- $images = $this->_getLocalImages();
63
- $numberOfPage = $this->totalImages / $this->limit;
64
- $totalPages = is_int($numberOfPage) ? $numberOfPage : (floor($numberOfPage) + 1);
65
- if ($this->page > $totalPages)
66
- $this->page = $totalPages;
67
- $this->pagination = $this->buildPager($this->totalImages);
68
-
69
- $images = $this->prepareLocalImages($images);
70
-
71
- return $images;
72
- }
73
-
74
- public function prepareLocalImages($images) {
75
- //process data before display
76
- $requestParams = $this->getRequest()->getParams();
77
- $filter_fields = array('filename','size', 'status');
78
- if( !empty($requestParams['order_by']) && in_array($requestParams['order_by'], $filter_fields)) {
79
- $order_by = $requestParams['order_by'];
80
- if(isset($requestParams['dir']) && $requestParams['dir']=='desc') {
81
- $this->order_dir = 'desc';
82
- }else {
83
- $this->order_dir = 'asc';
84
- }
85
- } else {
86
- $order_by = '' ;//default - image path
87
- }
88
- $this->order_by = $order_by;
89
-
90
- if($order_by == 'size') {
91
- usort($images, array("Imagerecycle_Imagerecycle_Block_Images","cmpSize") );
92
- }else if($order_by == 'status') {
93
- usort($images, array("Imagerecycle_Imagerecycle_Block_Images","cmpStatus"));
94
- }else if($order_by == 'filename' && $this->order_dir == 'desc') {
95
- usort($images, array("Imagerecycle_Imagerecycle_Block_Images","cmpNameDesc"));
96
- }
97
-
98
- $start = ($this->page - 1) * $this->limit;
99
- $result = array_slice($images, $start, $this->limit);
100
-
101
- return $result;
102
- }
103
-
104
- public function _getLocalImages() {
105
-
106
- $optimizedFiles = array();
107
- $resourceR = $this->getCoreRead('imagerecycle/images');
108
- $sql = "SELECT file,size_before FROM `{$resourceR->tableName}`";
109
- $optimizedFiles = $resourceR->fetchAssoc($sql);
110
-
111
- $this->totalOptimizedImages = count($optimizedFiles);
112
- $min_size = isset($this->settings['min_size']) ? (int)$this->settings['min_size']*1024 : 1* 1024;
113
- $max_size = !empty($this->settings['max_size']) ? (int)$this->settings['max_size'] * 1024 : 10000 * 1024;
114
- $images = array();
115
-
116
- $base_dir = Mage::getBaseDir();
117
- // Set a flag to prevent scanning over and over again by request
118
- Mage::getSingleton('core/session')->setData('scanning_local_images', true);
119
- $start = microtime(true);
120
- clearstatcache(); $counter = 0;
121
- foreach (new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($base_dir)) as $filename) {
122
- $continue = false;
123
- $this->totalFile++;
124
- // if( $counter > 100 ) break;
125
- foreach ($this->ignoredPath as $ignore_path) {
126
- $ignore_path = DIRECTORY_SEPARATOR . $ignore_path . DIRECTORY_SEPARATOR;
127
- if (strpos(substr($filename, strlen($base_dir)), $ignore_path) === 0 || strpos(substr($filename, strlen($base_dir)), DIRECTORY_SEPARATOR . 'adminhtml' . DIRECTORY_SEPARATOR) !== FALSE) {
128
- $continue = true;
129
- continue;
130
- }
131
- }
132
- if ($continue === true) {
133
- continue;
134
- }
135
-
136
- if (!in_array(strtolower(pathinfo($filename, PATHINFO_EXTENSION)), $this->allowed_ext)) {
137
- continue;
138
- }
139
-
140
- if(filesize($filename) < $min_size || filesize($filename) > $max_size ) {
141
- continue;
142
- }
143
- $data = array();
144
- $data['filename'] = str_replace('\\', '/', substr($filename, strlen($base_dir) + 1));
145
- $data['size'] = filesize($filename);
146
- $data['filetype'] = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
147
- if (isset($optimizedFiles[$data['filename']]) ) {
148
- $data['optimized'] = true;
149
- $data['optimized_datas'] = $optimizedFiles[$data['filename']];
150
- } else {
151
- $data['optimized'] = false;
152
- }
153
- $this->totalImages++;
154
-
155
- $images[] = $data; $counter++;
156
- }
157
- $this->time_elapsed_secs = microtime(true) - $start;
158
- //Unset image scanning in local flag
159
- Mage::getSingleton('core/session')->unsetData('scanning_local_images');
160
-
161
- return $images;
162
- }
163
-
164
- private function cmpStatus($a, $b)
165
- {
166
- if ($a['optimized'] == $b['optimized']) {
167
- return strcmp($a['filename'], $b['filename']);
168
- }
169
-
170
- if( $this->order_dir=='asc') {
171
- return strcmp($a['optimized'], $b['optimized']);
172
- }else {
173
- return strcmp($b['optimized'], $a['optimized']);
174
- }
175
- }
176
-
177
- private function cmpSize($a, $b)
178
- {
179
- if ($a['size'] == $b['size']) {
180
- return strcmp($a['filename'], $b['filename']);
181
- }
182
- if( $this->order_dir=='asc') {
183
- return ($a['size'] < $b['size']) ? -1 : 1;
184
- }else {
185
- return ($a['size'] < $b['size']) ? 1 : -1;
186
- }
187
- }
188
- private function cmpNameDesc($a, $b)
189
- {
190
- return strcmp($b['filename'], $a['filename']);
191
- }
192
-
193
- public function getTotalImages() {
194
- return $this->totalImages;
195
- }
196
-
197
- public function getTotalOptimizedImages() {
198
- return $this->totalOptimizedImages;
199
- }
200
-
201
- protected function buildPager($total) {
202
- $pagination = new stdClass();
203
-
204
- $numb = $total / $this->limit;
205
- if ($numb > 1) {
206
- if (!is_float($numb)) {
207
- $total_page = $numb;
208
- } else {
209
- $total_page = ceil($numb);
210
- }
211
- } else {
212
- $total_page = 1;
213
- }
214
-
215
- if ($total_page > $this->page_show) {
216
- $t_floor = floor($total_page / $this->page_show) + 1;
217
- $p_floor = floor($this->page / $this->page_show) + ($this->page % $this->page_show == 0 ? 0 : 1);
218
-
219
- if ($p_floor < $t_floor) {
220
- $pagination->range = range($p_floor * $this->page_show - ($this->page_show - 1), $p_floor * $this->page_show);
221
- } elseif ($p_floor = $t_floor) {
222
- $pagination->range = range(($p_floor - 1) * $this->page_show, $total_page);
223
- }
224
- } else {
225
- $pagination->range = range(1, $total_page);
226
- }
227
-
228
- $pagination->start = 1;
229
- $pagination->prev = $this->page > 1 ? $this->page - 1 : 1;
230
- $pagination->next = $this->page < $total_page ? $this->page + 1 : $total_page;
231
- $pagination->end = $total_page;
232
- $pagination->current = $this->page;
233
-
234
- #debug($pagination);
235
- return (int) $total_page > 1 ? $pagination : 0;
236
- }
237
-
238
- public function getCoreRead($entityId) {
239
- $resource = Mage::getSingleton('core/resource');
240
- $resourceR = $resource->getConnection('core_read');
241
- $tableName = $resource->getTableName($entityId);
242
- $resourceR->tableName = $tableName;
243
- return $resourceR;
244
- }
245
-
246
- public function getCoreWrite($entityId) {
247
- $resource = Mage::getSingleton('core/resource');
248
- $resourceW = $resource->getConnection('core_write');
249
- $tableName = $resource->getTableName($entityId);
250
- $resourceW->tableName = $tableName;
251
- return $resourceW;
252
- }
253
-
254
- public function getDataIgnore($key, $default = null) {
255
- return isset($this->{$key}) ? $this->{$key} : $default;
256
- }
257
-
258
- protected function trimToLower(&$string) {
259
- return strtolower(trim($string));
260
- }
261
-
262
- }
263
-
264
- class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator {
265
-
266
- function getChildren() {
267
- try {
268
- return new IgnorantRecursiveDirectoryIterator($this->getPathname());
269
- } catch (UnexpectedValueException $e) {
270
- return new RecursiveArrayIterator(array());
271
- }
272
- }
273
-
274
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ Class Imagerecycle_Imagerecycle_Block_Images extends Mage_Page_Block_Html {
4
+
5
+ private $allowed_ext = array('jpg', 'jpeg', 'png', 'gif','pdf');
6
+ private $ignoredPath = array('app', 'var', 'cache', 'adminhtml', '.', '..');
7
+ private $allowedPath = "";
8
+ protected $totalImages = 0;
9
+ protected $totalFile = 0;
10
+ protected $time_elapsed_secs = 0;
11
+ protected $totalOptimizedImages = 0;
12
+ protected $limit = 30;
13
+ protected $page_show = 10;
14
+ protected $order_by = '';
15
+ protected $order_dir = 'asc';
16
+
17
+ public function __construct() {
18
+ parent::__construct();
19
+ //Include ioaphp class once
20
+ include_once(Mage::getModuleDir('', 'Imagerecycle_Imagerecycle') . '/classes/ioa.class.php');
21
+ //Get settings
22
+ $this->settings = array(
23
+ 'api_key' => Mage::getStoreConfig('mageio_api_key'),
24
+ 'api_secret' => Mage::getStoreConfig('mageio_api_secret'),
25
+ 'installed_time' => Mage::getStoreConfig('mageio_installed_time'),
26
+ 'include_folders' => Mage::getStoreConfig('mageio_include_folders'),
27
+ 'saving_auto' => Mage::getStoreConfig('mageio_saving_auto'),
28
+ 'compress_auto' => Mage::getStoreConfig('mageio_compress_auto'),
29
+ 'resize_auto' => Mage::getStoreConfig('mageio_resize_auto'),
30
+ 'resize_image' => Mage::getStoreConfig('mageio_resize_image'),
31
+ 'min_size' => Mage::getStoreConfig('mageio_min_size'),
32
+ 'max_size' => Mage::getStoreConfig('mageio_max_size'),
33
+ 'compression_type_pdf' => Mage::getStoreConfig('mageio_compression_type_pdf'),
34
+ 'compression_type_png' => Mage::getStoreConfig('mageio_compression_type_png'),
35
+ 'compression_type_jpg' => Mage::getStoreConfig('mageio_compression_type_jpg'),
36
+ 'compression_type_jpeg' => Mage::getStoreConfig('mageio_compression_type_jpeg'),
37
+ 'compression_type_gif' => Mage::getStoreConfig('mageio_compression_type_gif'),
38
+ 'compression_type' => Mage::getStoreConfig('mageio_compression_type'),
39
+ );
40
+
41
+ $this->allowedPath = explode(',',$this->settings['include_folders']);
42
+
43
+ for($i=0;$i<count($this->allowed_ext); $i++) {
44
+ $compression_type = $this->settings['compression_type_'.$this->allowed_ext[$i]];
45
+ if($compression_type=="none") {
46
+ unset($this->allowed_ext[$i]);
47
+ }
48
+ }
49
+ $this->allowed_ext = array_values($this->allowed_ext);
50
+ //Get current page
51
+ $requestParams = $this->getRequest()->getParams();
52
+ $page = !empty($requestParams['page']) ? abs((int) $requestParams['page']) : 1;
53
+ $this->page = $page;
54
+ }
55
+ /*Load Image from Database
56
+ *@ Return Loaded and searched images
57
+ */
58
+ public function loadImage($name,$type,$size,$status){
59
+ $images = array();
60
+ $resourceR = $this->getCoreRead('imagerecycle/images');
61
+ $where = "";
62
+ //Path condition
63
+
64
+ if(count($this->allowedPath) != 0){
65
+ $i = 0;
66
+ foreach($this->allowedPath as $path){
67
+ if(!$path) return $images;
68
+ $i++;
69
+ $where .= ($i == 1)? " WHERE file LIKE CONCAT(".$resourceR->quote($path).",'%')" :" OR file LIKE CONCAT(".$resourceR->quote($path).",'%')";
70
+ }
71
+ $sql = "(SELECT * FROM `{$resourceR->tableName}`".$where.") AS tbl";
72
+ }
73
+ $where1 = " WHERE tbl.id > 0";
74
+
75
+ if($name){
76
+ $where1 .= " AND tbl.file LIKE CONCAT('%',".$resourceR->quote($name).",'%')";
77
+ }
78
+ if($type){
79
+ $where1 .= " AND tbl.ext LIKE CONCAT('%',".$resourceR->quote($type).")";
80
+ }
81
+
82
+ if($status == "opt") $where1 .= " AND tbl.extension = '1'";
83
+ else if($status == "unopt") $where1 .= " AND tbl.extension = ''";
84
+ $sqll = "SELECT * FROM ".$sql .$where1;
85
+ $images = $resourceR->fetchAssoc($sqll);
86
+ $this->totalImages = count($images);
87
+ $numberOfPage = $this->totalImages / $this->limit;
88
+ $totalPages = is_int($numberOfPage) ? $numberOfPage : (floor($numberOfPage) + 1);
89
+ if ($this->page > $totalPages)
90
+ $this->page = $totalPages;
91
+ $this->pagination = $this->buildPager($this->totalImages);
92
+ $images = $this->prepareLocalImages($images);
93
+ return $images;
94
+ }
95
+
96
+ public function alterversion(){
97
+
98
+ $resourceW = $this->getCoreWrite('imagerecycle/images');
99
+ //be careful if file exist
100
+ $dbname = Mage::getConfig()->getResourceConnectionConfig('default_setup')->dbname;
101
+ $sql = "SELECT IF ( EXISTS (SELECT * FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = '".$dbname. "' AND `TABLE_NAME` = '".$resourceW->tableName."' AND `COLUMN_NAME` = 'name' ),1, 0)";
102
+ $record7 = $resourceW->fetchOne($sql);
103
+
104
+ if(!$record7) // if table alreday exist and the table is old version
105
+ {
106
+ $resourceW->query("ALTER TABLE `{$resourceW->tableName}` ADD (`name` VARCHAR(250) NOT NULL,`ext` VARCHAR(250) NOT NULL)");
107
+ $images = $resourceW->fetchAssoc("SELECT * FROM `{$resourceW->tableName}`");
108
+ foreach($images as $image){
109
+ $filetype = strtolower(pathinfo($image['file'], PATHINFO_EXTENSION));
110
+ $name = substr($image['file'], strrpos($image['file'], "/")+1);
111
+ $name = substr($name, 0, strrpos($name, '.'));
112
+
113
+ $resourceW->query("UPDATE `{$resourceW->tableName}` SET `extension` ='1', `name` =".$resourceW->quote($name).", `ext` =".$resourceW->quote($filetype)." WHERE `id` = " .$resourceW->quote($image['id']));
114
+ }
115
+
116
+ }
117
+
118
+ }
119
+
120
+ public function prepareLocalImages($images) {
121
+ //process data before display
122
+ $requestParams = $this->getRequest()->getParams();
123
+ $filter_fields = array('filename','size', 'status');
124
+ if( !empty($requestParams['order_by']) && in_array($requestParams['order_by'], $filter_fields)) {
125
+ $order_by = $requestParams['order_by'];
126
+ if(isset($requestParams['dir']) && $requestParams['dir']=='desc') {
127
+ $this->order_dir = 'desc';
128
+ }else {
129
+ $this->order_dir = 'asc';
130
+ }
131
+ } else {
132
+ $order_by = '' ;
133
+ }
134
+ $this->order_by = $order_by;
135
+
136
+ if($order_by == 'size') {
137
+ usort($images, array("Imagerecycle_Imagerecycle_Block_Images","cmpSize") );
138
+ }else if($order_by == 'status') {
139
+ usort($images, array("Imagerecycle_Imagerecycle_Block_Images","cmpStatus"));
140
+ }else if($order_by == 'filename' && $this->order_dir == 'desc') {
141
+ usort($images, array("Imagerecycle_Imagerecycle_Block_Images","cmpNameDesc"));
142
+ }
143
+
144
+ $start = ($this->page - 1) * $this->limit;
145
+ $result = array_slice($images, $start, $this->limit);
146
+
147
+ return $result;
148
+ }
149
+
150
+ public function _getLocalImages() {
151
+
152
+ $resourceW = $this->getCoreWrite('imagerecycle/images');
153
+
154
+ $min_size = isset($this->settings['min_size']) ? (int)$this->settings['min_size']*1024 : 1* 1024;
155
+ $max_size = !empty($this->settings['max_size']) ? (int)$this->settings['max_size'] * 1024 : 10000 * 1024;
156
+ $images = array();
157
+
158
+ if(Mage::getStoreConfig('mageio_include_folders') == '')
159
+ $base_dir = Mage::getBaseDir();
160
+ else
161
+ $base_dir = Mage::getBaseDir().DIRECTORY_SEPARATOR;
162
+
163
+ // Set a flag to prevent scanning over and over again by request
164
+ Mage::getSingleton('core/session')->setData('scanning_local_images', true);
165
+ $start = microtime(true);
166
+ clearstatcache(); $counter = 0;
167
+ foreach($this->allowedPath as $base){
168
+ $base = $base_dir . $base;
169
+
170
+ if (!file_exists($base)) {
171
+ continue;
172
+ }
173
+ foreach (new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($base)) as $filename) {
174
+ $continue = false;
175
+ $this->totalFile++;
176
+ foreach ($this->ignoredPath as $ignore_path) {
177
+ $ignore_path = DIRECTORY_SEPARATOR . $ignore_path . DIRECTORY_SEPARATOR;
178
+ if (strpos(substr($filename, strlen($base)), $ignore_path) === 0 || strpos(substr($filename, strlen($base)), DIRECTORY_SEPARATOR . 'adminhtml' . DIRECTORY_SEPARATOR) !== FALSE) {
179
+ $continue = true;
180
+ continue;
181
+ }
182
+ }
183
+ if ($continue === true) {
184
+ continue;
185
+ }
186
+ if (!in_array(strtolower(pathinfo($filename, PATHINFO_EXTENSION)), $this->allowed_ext)) {
187
+ continue;
188
+ }
189
+
190
+ if(filesize($filename) < $min_size || filesize($filename) > $max_size ) {
191
+ continue;
192
+ }
193
+
194
+ $data = array();
195
+ if(Mage::getStoreConfig('mageio_include_folders') == ''){
196
+ $data['filename'] = str_replace('\\', '/', substr($filename, strlen($base_dir) + 1));
197
+ }
198
+ else{
199
+ $data['filename'] = str_replace('\\', '/', substr($filename, strlen($base_dir)));
200
+ }
201
+
202
+ $data['size'] = filesize($filename);
203
+ $data['filetype'] = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
204
+
205
+ $this->totalImages++;
206
+ $images[] = $data; $counter++;
207
+
208
+ $id = $resourceW->fetchOne("SELECT id FROM {$resourceW->tableName} WHERE `file` = " . $resourceW->quote($data['filename']));
209
+ if (!$id) {
210
+ $name = substr($data['filename'], strrpos($data['filename'], "/")+1);
211
+ $name = substr($name, 0, strrpos($name, '.'));
212
+ $resourceW->query("INSERT INTO `{$resourceW->tableName}` (`file`, `size_before`, `name`, `ext`) VALUES ("
213
+ . $resourceW->quote($data['filename']) .",". $resourceW->quote($data['size']).",". $resourceW->quote($name). ",".$resourceW->quote($data['filetype']).")");
214
+ }
215
+ }
216
+
217
+ }
218
+ $this->time_elapsed_secs = microtime(true) - $start;
219
+
220
+ $coreConfig = Mage::getConfig();
221
+ $coreConfig->saveConfig('mageio_loadimage', Mage::helper('core')->escapeHtml('on'))->cleanCache();
222
+ //Unset image scanning in local flag
223
+ Mage::getSingleton('core/session')->unsetData('scanning_local_images');
224
+ return $images;
225
+ }
226
+
227
+ private function cmpStatus($a, $b)
228
+ {
229
+ if ($a['optimized'] == $b['optimized']) {
230
+ return strcmp($a['filename'], $b['filename']);
231
+ }
232
+
233
+ if( $this->order_dir=='asc') {
234
+ return strcmp($a['optimized'], $b['optimized']);
235
+ }else {
236
+ return strcmp($b['optimized'], $a['optimized']);
237
+ }
238
+ }
239
+
240
+ private function cmpSize($a, $b)
241
+ {
242
+ if ($a['size'] == $b['size']) {
243
+ return strcmp($a['filename'], $b['filename']);
244
+ }
245
+ if( $this->order_dir=='asc') {
246
+ return ($a['size'] < $b['size']) ? -1 : 1;
247
+ }else {
248
+ return ($a['size'] < $b['size']) ? 1 : -1;
249
+ }
250
+ }
251
+ private function cmpNameDesc($a, $b)
252
+ {
253
+ return strcmp($b['filename'], $a['filename']);
254
+ }
255
+
256
+ public function getTotalImages() {
257
+ return $this->totalImages;
258
+ }
259
+
260
+ public function getTotalOptimizedImages() {
261
+ return $this->totalOptimizedImages;
262
+ }
263
+
264
+ protected function buildPager($total) {
265
+ $pagination = new stdClass();
266
+
267
+ $numb = $total / $this->limit;
268
+ if ($numb > 1) {
269
+ if (!is_float($numb)) {
270
+ $total_page = $numb;
271
+ } else {
272
+ $total_page = ceil($numb);
273
+ }
274
+ } else {
275
+ $total_page = 1;
276
+ }
277
+
278
+ if ($total_page > $this->page_show) {
279
+ $t_floor = floor($total_page / $this->page_show) + 1;
280
+ $p_floor = floor($this->page / $this->page_show) + ($this->page % $this->page_show == 0 ? 0 : 1);
281
+
282
+ if ($p_floor < $t_floor) {
283
+ $pagination->range = range($p_floor * $this->page_show - ($this->page_show - 1), $p_floor * $this->page_show);
284
+ } elseif ($p_floor = $t_floor) {
285
+ $pagination->range = range(($p_floor - 1) * $this->page_show, $total_page);
286
+ }
287
+ } else {
288
+ $pagination->range = range(1, $total_page);
289
+ }
290
+ $pagination->start = 1;
291
+ $pagination->prev = $this->page > 1 ? $this->page - 1 : 1;
292
+ $pagination->next = $this->page < $total_page ? $this->page + 1 : $total_page;
293
+ $pagination->end = $total_page;
294
+ $pagination->current = $this->page;
295
+ return (int) $total_page > 1 ? $pagination : 0;
296
+ }
297
+ public function getCoreRead($entityId) {
298
+ $resource = Mage::getSingleton('core/resource');
299
+ $resourceR = $resource->getConnection('core_read');
300
+ $tableName = $resource->getTableName($entityId);
301
+ $resourceR->tableName = $tableName;
302
+ return $resourceR;
303
+ }
304
+ public function getCoreWrite($entityId) {
305
+ $resource = Mage::getSingleton('core/resource');
306
+ $resourceW = $resource->getConnection('core_write');
307
+ $tableName = $resource->getTableName($entityId);
308
+ $resourceW->tableName = $tableName;
309
+ return $resourceW;
310
+ }
311
+ public function getDataIgnore($key, $default = null) {
312
+ return isset($this->{$key}) ? $this->{$key} : $default;
313
+ }
314
+ protected function trimToLower(&$string) {
315
+ return strtolower(trim($string));
316
+ }
317
+
318
+ public function getOptimizedImages(){
319
+
320
+ $resourceR = $this->getCoreRead('imagerecycle/images');
321
+ $sql = "SELECT COUNT(*) AS `num` FROM `{$resourceR->tableName}` where `extension` = '1'";
322
+ $optimizedCount = $resourceR->fetchOne($sql);
323
+ return $optimizedCount;
324
+
325
+ }
326
+ }
327
+
328
+ class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator {
329
+
330
+ function getChildren() {
331
+ try {
332
+ return new IgnorantRecursiveDirectoryIterator($this->getPathname());
333
+ } catch (UnexpectedValueException $e) {
334
+ return new RecursiveArrayIterator(array());
335
+ }
336
+ }
337
+
338
+ }
app/code/community/Imagerecycle/Imagerecycle/Block/Notifications.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ Class Imagerecycle_Imagerecycle_Block_Notifications extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function _toHtml($className = "notification-global")
6
+ {
7
+ // Let other extensions add messages
8
+ Mage::dispatchEvent('imagerecycle_notifications_before');
9
+ // Get the global notification object
10
+ $messages = Mage::getSingleton('imagerecycle/notification')->getMessages();
11
+ $html = null;
12
+ foreach ($messages as $message) {
13
+ $html .= "<div class='$className'>" . $message . "</div>";
14
+ } /* */
15
+ return $html;
16
+ }
17
+ }
18
+
app/code/community/Imagerecycle/Imagerecycle/Block/Settings.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ Class Imagerecycle_Imagerecycle_Block_Settings extends Mage_Page_Block_Html {
4
+
5
+ private $allowed_ext = array('jpg', 'jpeg', 'png', 'gif','pdf');
6
+ private $ignoredPath = array('app', 'var', 'cache', 'adminhtml', '.', '..');
7
+ private $allowedPath = "";
8
+
9
+ public function __construct() {
10
+ parent::__construct();
11
+ //Get settings
12
+ $this->settings = array(
13
+ 'api_key' => Mage::getStoreConfig('mageio_api_key'),
14
+ 'api_secret' => Mage::getStoreConfig('mageio_api_secret'),
15
+ 'installed_time' => Mage::getStoreConfig('mageio_installed_time'),
16
+ 'include_folders' => Mage::getStoreConfig('mageio_include_folders'),
17
+ 'reindex_init' => Mage::getStoreConfig('mageio_reindex_init'),
18
+ 'saving_auto' => Mage::getStoreConfig('mageio_saving_auto'),
19
+ 'compress_auto' => Mage::getStoreConfig('mageio_compress_auto'),
20
+ 'cron_periodicity' => Mage::getStoreConfig('mageio_cron_periodicity'),
21
+ 'resize_auto' => Mage::getStoreConfig('mageio_resize_auto'),
22
+ 'resize_image' => Mage::getStoreConfig('mageio_resize_image'),
23
+ 'min_size' => Mage::getStoreConfig('mageio_min_size'),
24
+ 'max_size' => Mage::getStoreConfig('mageio_max_size'),
25
+ 'compression_type_pdf' => Mage::getStoreConfig('mageio_compression_type_pdf'),
26
+ 'compression_type_png' => Mage::getStoreConfig('mageio_compression_type_png'),
27
+ 'compression_type_jpg' => Mage::getStoreConfig('mageio_compression_type_jpg'),
28
+ 'compression_type_jpeg' => Mage::getStoreConfig('mageio_compression_type_jpeg'),
29
+ 'compression_type_gif' => Mage::getStoreConfig('mageio_compression_type_gif'),
30
+ 'compression_type' => Mage::getStoreConfig('mageio_compression_type'),
31
+ );
32
+
33
+ $this->allowedPath = explode(',',$this->settings['include_folders']);
34
+
35
+ for($i=0;$i<count($this->allowed_ext); $i++) {
36
+ $compression_type = $this->settings['compression_type_'.$this->allowed_ext[$i]];
37
+ if($compression_type=="none") {
38
+ unset($this->allowed_ext[$i]);
39
+ }
40
+ }
41
+ $this->allowed_ext = array_values($this->allowed_ext);
42
+
43
+ }
44
+
45
+ public function formateBytes($data)
46
+ {
47
+ if($data < 1024)
48
+ return round($data, 2).'Bytes';
49
+ $data = $data/1024;
50
+ if($data < 1024)
51
+ return round($data, 2).'KB';
52
+ $data = $data/1024;
53
+ if($data < 1024)
54
+ return round($data, 2).'MB';
55
+
56
+ $data = $data/1024;
57
+ return round($data, 2).'GB';
58
+
59
+ }
60
+
61
+ public function senddata()
62
+ {
63
+ return 'hi';
64
+ }
65
+ }
66
+
app/code/community/Imagerecycle/Imagerecycle/Helper/Data.php CHANGED
@@ -3,13 +3,13 @@ Class Imagerecycle_Imagerecycle_Helper_Data extends Mage_Core_Helper_Abstract{
3
 
4
  private $allowed_ext = array('jpg', 'jpeg', 'png', 'gif','pdf');
5
  public $settings = null;
6
-
7
  public function getSettings() {
8
  return array(
9
  'api_key' => Mage::getStoreConfig('mageio_api_key'),
10
  'api_secret' => Mage::getStoreConfig('mageio_api_secret'),
11
  'installed_time' => Mage::getStoreConfig('mageio_installed_time'),
12
- 'exclude_folders' => Mage::getStoreConfig('mageio_exclude_folders'),
13
  'resize_auto' => Mage::getStoreConfig('mageio_resize_auto'),
14
  'resize_image' => Mage::getStoreConfig('mageio_resize_image'),
15
  'min_size' => Mage::getStoreConfig('mageio_min_size'),
@@ -21,8 +21,14 @@ Class Imagerecycle_Imagerecycle_Helper_Data extends Mage_Core_Helper_Abstract{
21
  'compression_type' => Mage::getStoreConfig('mageio_compression_type'),
22
  );
23
  }
24
- public function optimize($image, $savePath='') {
25
-
 
 
 
 
 
 
26
  $response = new stdClass();
27
  $response->status = false;
28
  $response->msg = Mage::helper('imagerecycle')->__('Not be optimized yet');
@@ -31,7 +37,6 @@ Class Imagerecycle_Imagerecycle_Helper_Data extends Mage_Core_Helper_Abstract{
31
  $response->msg = Mage::helper('imagerecycle')->__('This image type is not allowed');
32
  return $response;
33
  }
34
-
35
  if (!file_exists($file)) {
36
  $response->msg = Mage::helper('imagerecycle')->__('File not found');
37
  return $response;
@@ -42,13 +47,12 @@ Class Imagerecycle_Imagerecycle_Helper_Data extends Mage_Core_Helper_Abstract{
42
  if(!$this->settings) {
43
  $this->settings = $this->getSettings();
44
  }
45
- $ext = array_pop( explode('.',$file));
46
  $compressionType= $this->settings['compression_type_'.$ext];
47
  if($compressionType=='none') return $response;
48
-
49
  if (!$this->settings['api_key'] || !$this->settings['api_secret'] )
50
  {
51
-
52
  $response->msg = Mage::helper('imagerecycle')->__("You haven't configured Image recycle setting correctly yet.");
53
  return $response;
54
  }
@@ -62,16 +66,22 @@ Class Imagerecycle_Imagerecycle_Helper_Data extends Mage_Core_Helper_Abstract{
62
  $fparams['resize'] = array("width"=> $resize_image);
63
  }
64
  }
65
-
66
  include_once(Mage::getModuleDir('', 'Imagerecycle_Imagerecycle') . '/classes/ioa.class.php');
67
  $ioa = new ioaphp($this->settings['api_key'], $this->settings['api_secret']);
68
  $return = $ioa->uploadFile($file,$fparams);
69
- Mage::log($return);
70
 
71
  if ($return === false || $return === null || is_string($return)) {
 
 
 
 
72
  $response->msg = $ioa->getLastError();
73
  return $response;
74
  }
 
 
 
 
75
  $md5 = md5_file($file);
76
  clearstatcache();
77
  $sizebefore = filesize($file);
@@ -88,29 +98,96 @@ Class Imagerecycle_Imagerecycle_Helper_Data extends Mage_Core_Helper_Abstract{
88
  }
89
  clearstatcache();
90
  $size_after = filesize($file);
91
-
92
- if($savePath=='') { $savePath = $image;}
93
- $id = $resourceW->fetchOne("SELECT id FROM {$resourceW->tableName} WHERE `file` = " . $resourceW->quote($savePath));
94
  if (!$id) {
95
- $resourceW->query("INSERT INTO `{$resourceW->tableName}` (`file`,`md5`,`api_id`,`size_before`, `size_after`,`date`) VALUES ("
96
- . $resourceW->quote($savePath) . "," . $resourceW->quote($md5) . "," . $return->id . "," . (int) $sizebefore . "," . (int) $size_after . ", '" . date('Y-m-d H:i:s') . "' )");
97
  } else {
98
- $resourceW->query("UPDATE `{$resourceW->tableName}` SET `size_after` = " . (int) $size_after . " WHERE `id` = " . $id);
99
- }
100
-
101
- $response->status = true;
102
-
103
  $response->msg = 'Optimized at '. round(($sizebefore-$size_after)/$sizebefore*100,2).'%';
104
  $response->newSize = number_format($size_after/1000, 2, '.', '') ;
105
  return $response;
106
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
  public function checkOptimize($image) {
 
 
109
  $resourceW = $this->getCoreWrite('imagerecycle/images');
110
- $id = $resourceW->fetchOne("SELECT id FROM {$resourceW->tableName} WHERE `file` = " . $resourceW->quote($image));
111
  return $id;
112
  }
113
-
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  /**
115
  * Get content of specified resource via curl or file_get_content() function
116
  */
@@ -156,5 +233,19 @@ Class Imagerecycle_Imagerecycle_Helper_Data extends Mage_Core_Helper_Abstract{
156
  $resourceW->tableName = $tableName;
157
  return $resourceW;
158
  }
159
-
 
 
 
 
 
 
 
 
 
 
 
 
160
  }
 
 
3
 
4
  private $allowed_ext = array('jpg', 'jpeg', 'png', 'gif','pdf');
5
  public $settings = null;
6
+ private $allowedPath = "";
7
  public function getSettings() {
8
  return array(
9
  'api_key' => Mage::getStoreConfig('mageio_api_key'),
10
  'api_secret' => Mage::getStoreConfig('mageio_api_secret'),
11
  'installed_time' => Mage::getStoreConfig('mageio_installed_time'),
12
+ 'include_folders' => Mage::getStoreConfig('mageio_include_folders'),
13
  'resize_auto' => Mage::getStoreConfig('mageio_resize_auto'),
14
  'resize_image' => Mage::getStoreConfig('mageio_resize_image'),
15
  'min_size' => Mage::getStoreConfig('mageio_min_size'),
21
  'compression_type' => Mage::getStoreConfig('mageio_compression_type'),
22
  );
23
  }
24
+
25
+ public function getCurImages(){
26
+ $resourceR = $this->getCoreRead('imagerecycle/images');
27
+ $sql = "SELECT COUNT(*) AS `num` FROM `{$resourceR->tableName}` LIMIT 1";
28
+ $optimizedCount = $resourceR->fetchOne($sql);
29
+ return $optimizedCount;
30
+ }
31
+ public function optimize($image) {
32
  $response = new stdClass();
33
  $response->status = false;
34
  $response->msg = Mage::helper('imagerecycle')->__('Not be optimized yet');
37
  $response->msg = Mage::helper('imagerecycle')->__('This image type is not allowed');
38
  return $response;
39
  }
 
40
  if (!file_exists($file)) {
41
  $response->msg = Mage::helper('imagerecycle')->__('File not found');
42
  return $response;
47
  if(!$this->settings) {
48
  $this->settings = $this->getSettings();
49
  }
50
+ $ext = substr($file, strrpos($file, '.')+1);
51
  $compressionType= $this->settings['compression_type_'.$ext];
52
  if($compressionType=='none') return $response;
53
+
54
  if (!$this->settings['api_key'] || !$this->settings['api_secret'] )
55
  {
 
56
  $response->msg = Mage::helper('imagerecycle')->__("You haven't configured Image recycle setting correctly yet.");
57
  return $response;
58
  }
66
  $fparams['resize'] = array("width"=> $resize_image);
67
  }
68
  }
 
69
  include_once(Mage::getModuleDir('', 'Imagerecycle_Imagerecycle') . '/classes/ioa.class.php');
70
  $ioa = new ioaphp($this->settings['api_key'], $this->settings['api_secret']);
71
  $return = $ioa->uploadFile($file,$fparams);
 
72
 
73
  if ($return === false || $return === null || is_string($return)) {
74
+
75
+ // patch the event that there is the error
76
+ $event_data_array = array('type' => $ioa->getLastError());
77
+ $this->checkError($response);
78
  $response->msg = $ioa->getLastError();
79
  return $response;
80
  }
81
+ $coreConfig = Mage::getConfig();
82
+ $coreConfig->saveConfig("mageio_errormessage", Mage::helper('core')->escapeHtml(null))->cleanCache();
83
+
84
+ Mage::dispatchEvent('imagerecycle_notifications_before');
85
  $md5 = md5_file($file);
86
  clearstatcache();
87
  $sizebefore = filesize($file);
98
  }
99
  clearstatcache();
100
  $size_after = filesize($file);
101
+
102
+ $id = $resourceW->fetchOne("SELECT id FROM `{$resourceW->tableName}` WHERE `file` = " . $resourceW->quote($image));
 
103
  if (!$id) {
104
+ $resourceW->query("INSERT INTO `{$resourceW->tableName}` (`file`,`md5`,`api_id`,`size_before`, `size_after`,`date`, `extension`) VALUES ("
105
+ . $resourceW->quote($image) . "," . $resourceW->quote($md5) . "," . $resourceW->quote($return->id) . "," . (int) $sizebefore . "," . (int) $size_after . ", '" . date('Y-m-d H:i:s') . "', '1')");
106
  } else {
107
+ $resourceW->query("UPDATE `{$resourceW->tableName}` SET `extension` ='1',`api_id` =".$resourceW->quote($return->id) .", `md5` =".$resourceW->quote($md5)." , `size_after` = " . (int) $size_after . " WHERE `id` = " . $resourceW->quote($id));
108
+ }
109
+
110
+ $response->status = true;
 
111
  $response->msg = 'Optimized at '. round(($sizebefore-$size_after)/$sizebefore*100,2).'%';
112
  $response->newSize = number_format($size_after/1000, 2, '.', '') ;
113
  return $response;
114
  }
115
+
116
+ protected function checkError($response){
117
+ $coreConfig = Mage::getConfig();
118
+ $count = Mage::getStoreConfig('mageio_lasterror');
119
+ $count++;
120
+ if($count >= 3){
121
+ $coreConfig->saveConfig("mageio_saving_auto", Mage::helper('core')->escapeHtml('0'));
122
+ $coreConfig->saveConfig("mageio_compress_auto", Mage::helper('core')->escapeHtml('0'));
123
+ $response->error = 'The automatic optimization options of ImageRecycle have been deactivated due to too many consecutive errors. Please check your account on https://www.imagerecycle.com/my-account';
124
+
125
+ $coreConfig->saveConfig("mageio_errormessage", Mage::helper('core')->escapeHtml('on'));
126
+ Mage::dispatchEvent('imagerecycle_notifications_before');
127
+ $count = 0;
128
+ }
129
+ $coreConfig->saveConfig("mageio_lasterror", Mage::helper('core')->escapeHtml($count));
130
+ $coreConfig->cleanCache();
131
+ }
132
+
133
+ public function _revert($image) {
134
+ $response = new stdClass();
135
+ $response->status = false;
136
+ $response->msg = Mage::helper('imagerecycle')->__('Not be reverted yet');
137
+ $resourceR = $this->getCoreRead('imagerecycle/images');
138
+ $resourceW = $this->getCoreWrite('imagerecycle/images');
139
+ $api_id = $resourceR->fetchOne("SELECT api_id FROM {$resourceR->tableName} WHERE `file` = " . $resourceR->quote($image));
140
+ if ($api_id) {
141
+ if(!$this->settings) {
142
+ $this->settings = $this->getSettings();
143
+ }
144
+ $ioa = new ioaphp($this->settings['api_key'], $this->settings['api_secret']);
145
+ $return = $ioa->getImage($api_id);
146
+ if (!isset($return->id)) {
147
+ $response->msg = Mage::helper('imagerecycle')->__('api id is not correct');
148
+ return $response;
149
+ }
150
+ $fileContent = file_get_contents($return->origin_url);
151
+ if ($fileContent === false) {
152
+ $response->msg = Mage::helper('imagerecycle')->__('Image not found');
153
+ return $response;
154
+ }
155
+ $file = realpath($image);
156
+ if (file_put_contents($file, $fileContent) === false) {
157
+ $response->msg = Mage::helper('imagerecycle')->__("Can't write file");
158
+ return $response;
159
+ }
160
+ clearstatcache();
161
+ $size_after = filesize($file);
162
+ $resourceW->query("UPDATE `{$resourceW->tableName}` SET `date` = '' ,`api_id` = '' ,`extension` = '' ,`md5` = '' , `size_after` ='' WHERE api_id = " . $resourceW->quote($api_id));
163
+ $response->newSize = number_format($size_after/1000, 2, '.', '') ;
164
+ $response->status = true;
165
+ $response->msg = Mage::helper('imagerecycle')->__('Reverted');
166
+ }
167
+ return $response;
168
+ }
169
 
170
  public function checkOptimize($image) {
171
+
172
+ // ??? is it possible after the product has been upload but the data is not optimiexe
173
  $resourceW = $this->getCoreWrite('imagerecycle/images');
174
+ $id = $resourceW->fetchOne("SELECT `extension` FROM {$resourceW->tableName} WHERE `file` = " . $resourceW->quote($image));
175
  return $id;
176
  }
177
+
178
+ public function checkOptimizeTmp($image) {
179
+
180
+ // ??? is it possible after the product has been upload but the data is not optimiexe
181
+ $resourceW = $this->getCoreWrite('imagerecycle/images');
182
+ $id = $resourceW->fetchOne("SELECT `id` FROM {$resourceW->tableName} WHERE `file` = " . $resourceW->quote($image));
183
+ return $id;
184
+ }
185
+
186
+ public function updateOptdata($src, $dst){
187
+ $resourceW = $this->getCoreWrite('imagerecycle/images');
188
+ $id = $resourceW->fetchOne("SELECT id FROM `{$resourceW->tableName}` WHERE `file` = " . $resourceW->quote($src));
189
+ $resourceW->query("UPDATE `{$resourceW->tableName}` SET `file` =".$resourceW->quote($dst)." WHERE `id` = " . $resourceW->quote($id));
190
+ }
191
  /**
192
  * Get content of specified resource via curl or file_get_content() function
193
  */
233
  $resourceW->tableName = $tableName;
234
  return $resourceW;
235
  }
236
+
237
+ public function getLastTime(){
238
+ return Mage::getStoreConfig('mageio_ao_lastRun');
239
+ }
240
+
241
+ public function setLastTime($time){
242
+ $coreConfig = Mage::getConfig();
243
+ $coreConfig->saveConfig("mageio_ao_lastRun", Mage::helper('core')->escapeHtml($time))->cleanCache();
244
+ }
245
+
246
+ public function getStatus(){
247
+ return Mage::getStoreConfig('optimizeall_flag');
248
+ }
249
  }
250
+
251
+
app/code/community/Imagerecycle/Imagerecycle/Model/Notification.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Imagerecycle_Imagerecycle_Model_Notification extends Varien_object{
3
+ protected $messages = [ ];
4
+
5
+ public function getMessages()
6
+ {
7
+ return $this->messages;
8
+ }
9
+
10
+ public function setMessages($messages)
11
+ {
12
+ $this->messages = $messages;
13
+ return $this;
14
+ }
15
+
16
+ public function addMessage($message)
17
+ {
18
+ $this->messages[] = $message;
19
+ return $this;
20
+ }
21
+ }
app/code/community/Imagerecycle/Imagerecycle/Model/Observer.php CHANGED
@@ -1,70 +1,197 @@
1
- <?php
2
- class Imagerecycle_Imagerecycle_Model_Observer {
3
-
4
- public function imageuploaded($observer) {
5
- //$observer contains data passed from when the event was triggered.
6
- //You can use this data to manipulate the order data before it's saved.
7
- //Uncomment the line below to log what is contained here:
8
- $data = $observer->getEvent()->getData();
9
- $picture = $data['result'];
10
- Mage::log($picture);
11
- if(!$picture['error']) {
12
- include_once(__DIR__.'/../Helper/Data.php');
13
- $helper = new Imagerecycle_Imagerecycle_Helper_Data();
14
- $baseMedia = 'media';
15
- $return = $helper->optimize( $baseMedia . '/tmp/catalog/product' .$picture['file'], $baseMedia . '/catalog/product' .$picture['file']);
16
- Mage::log($return);
17
- }
18
- }
19
-
20
- public function productsaved($observer) {
21
- Mage::log('product after saved!');
22
- $productId = $observer->getProduct()->getId();
23
- $model = Mage::getModel('catalog/product');
24
- $_product = $model->load($productId);
25
-
26
- include_once(__DIR__.'/../Helper/Data.php');
27
- $helper = new Imagerecycle_Imagerecycle_Helper_Data();
28
- $baseMedia = 'media';
29
- foreach ($_product->getMediaGalleryImages() as $image) {
30
- $file = $baseMedia . '/catalog/product'. $image['file'];
31
- if(!$helper->checkOptimize($file)) {
32
- $return = $helper->optimize($file);
33
- Mage::log($return);
34
- }
35
- }
36
-
37
- }
38
-
39
- public function categorySaved($observer) {
40
- Mage::log('category after saved!');
41
-
42
- $categoryId = $observer->getEvent()->getCategory()->getId();
43
- $model = Mage::getModel('catalog/category');
44
- $category = $model->load($categoryId);
45
- $image = $category->getImage();
46
- $thumbnail = $category->getThumbnail();
47
-
48
- include_once(__DIR__.'/../Helper/Data.php');
49
- $helper = new Imagerecycle_Imagerecycle_Helper_Data();
50
- $baseMedia = 'media';
51
- if($image!='') {
52
- $file = $baseMedia .'/catalog/category/'. $image;
53
- if(!$helper->checkOptimize($file)) {
54
- $return = $helper->optimize($file);
55
- Mage::log($return);
56
- }
57
- }
58
-
59
- if($thumbnail!='') {
60
- $file = $baseMedia .'/catalog/category/'. $thumbnail;
61
- if(!$helper->checkOptimize($file)) {
62
- $return = $helper->optimize($file);
63
- Mage::log($return);
64
- }
65
- }
66
-
67
- }
68
-
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  ?>
1
+ <?php
2
+ class Imagerecycle_Imagerecycle_Model_Observer {
3
+
4
+ public function cronexec($observer){
5
+
6
+ //preprocessing
7
+ //count the time 5 mins 10 mins 20mins 30min 1h 2h 6h 12h 24h 48h mageio_compress_auto
8
+ if( Mage::getStoreConfig('mageio_compress_auto') == '2')
9
+ {
10
+ $now = time();
11
+ $ao_lastRun = Mage::getStoreConfig('mageio_crontime');
12
+ $diff= $now - $ao_lastRun;
13
+ $cron_periodiciy = $this->getCronPeriodicity() * 60;
14
+ if($diff < $cron_periodiciy)
15
+ return;
16
+ $this->cronoptall();
17
+ $coreConfig = Mage::getConfig();
18
+ $coreConfig->saveConfig('mageio_crontime', Mage::helper('core')->escapeHtml($now))->cleanCache();
19
+ }
20
+ }
21
+
22
+ public function checkResponse($observer){
23
+ if( Mage::getStoreConfig('mageio_compress_auto') == '1')
24
+ {
25
+ $now = time();
26
+ $ao_lastRun = Mage::getStoreConfig('mageio_runtime_ajax');
27
+ if($now - $ao_lastRun < 3000 ) {
28
+ return;
29
+ }
30
+ $coreConfig = Mage::getConfig();
31
+ $coreConfig->saveConfig('mageio_runtime_ajax', Mage::helper('core')->escapeHtml($now))->cleanCache();
32
+ $this->cronoptall();
33
+ }
34
+ }
35
+ public function imageuploaded($observer) {
36
+
37
+ //$observer contains data passed from when the event was triggered.
38
+ //You can use this data to manipulate the order data before it's saved.
39
+ //Uncomment the line below to log what is contained here:
40
+
41
+ $flag = Mage::getStoreConfig('mageio_saving_auto');
42
+ if(!$flag) return;
43
+
44
+ $data = $observer->getEvent()->getData();
45
+ $picture = $data['result'];
46
+ Mage::log($picture);
47
+ if(!$picture['error']) {
48
+ include_once(__DIR__.'/../Helper/Data.php');
49
+ $helper = new Imagerecycle_Imagerecycle_Helper_Data();
50
+ $baseMedia = 'media';
51
+ $return = $helper->optimize( $baseMedia . '/tmp/catalog/product' .$picture['file'], $baseMedia . '/catalog/product' .$picture['file']);
52
+ Mage::log($return);
53
+ }
54
+
55
+ }
56
+
57
+ public function cronoptall(){
58
+ $now = time();
59
+ $ao_lastRun = Mage::getStoreConfig('mageio_runtime');
60
+ $diff = $now - $ao_lastRun;
61
+ if(Mage::getStoreConfig('mageio_autosettig') == 'On')
62
+ {
63
+ if($now - $ao_lastRun < 1000 ) {
64
+ return;
65
+ }
66
+ }
67
+ $coreConfig = Mage::getConfig();
68
+ $coreConfig->saveConfig("mageio_autosettig", Mage::helper('core')->escapeHtml('On'));
69
+ $coreConfig->saveConfig("mageio_OptResponse", Mage::helper('core')->escapeHtml('On'));
70
+ $coreConfig->saveConfig("mageio_runtime", Mage::helper('core')->escapeHtml($now));
71
+ $coreConfig->cleanCache();
72
+ $this->headRequest();
73
+ /**/
74
+ }
75
+
76
+ public function checkMessages($observer)
77
+ {
78
+ if(Mage::getStoreConfig('mageio_errormessage') == 'on'){
79
+ $notifications = Mage::getSingleton('imagerecycle/notification');
80
+ $notifications->addMessage('The automatic optimization options of ImageRecycle have been deactivated due to too many consecutive errors. Please check your account on <a href = "https://www.imagerecycle.com/my-account">https://www.imagerecycle.com/my-account</a><br/>To remove this message please got to the settings page and save the settings');
81
+ }
82
+ return $observer;
83
+ }
84
+
85
+ public function checkError($observer){
86
+
87
+ $coreConfig = Mage::getConfig();
88
+ $count = Mage::getStoreConfig('mageio_lasterror');
89
+ $count++;
90
+ $coreConfig->saveConfig("mageio_lasterror", Mage::helper('core')->escapeHtml($count))->cleanCache();
91
+ }
92
+
93
+ protected function headRequest(){
94
+ if( function_exists('curl_version')) {
95
+ $ch = curl_init();
96
+ $url = Mage::getBaseUrl().'imagerecycle/ImageAll/index';
97
+ curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
98
+ curl_setopt ($ch, CURLOPT_URL, $url);
99
+ curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 20);
100
+ curl_setopt ($ch, CURLOPT_TIMEOUT_MS, 1000);
101
+ // Only calling the head
102
+ curl_setopt($ch, CURLOPT_HEADER, true); // header will be at output
103
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD'
104
+ $content = curl_exec ($ch);
105
+ curl_close ($ch);
106
+ }else {
107
+ return;
108
+ }
109
+ }
110
+
111
+ public function productsaved($observer) {
112
+
113
+ $flag = Mage::getStoreConfig('mageio_saving_auto');
114
+ if(!$flag) return;
115
+ $productId = $observer->getProduct()->getId();
116
+ $model = Mage::getModel('catalog/product');
117
+ $_product = $model->load($productId);
118
+
119
+ include_once(__DIR__.'/../Helper/Data.php');
120
+ $helper = new Imagerecycle_Imagerecycle_Helper_Data();
121
+ $baseMedia = 'media';
122
+ foreach ($_product->getMediaGalleryImages() as $image) {
123
+
124
+ $tmpfile = $baseMedia . '/tmp/catalog/product'. $image['file'];
125
+ $file = $baseMedia . '/catalog/product'. $image['file'];
126
+ if($helper->checkOptimizeTmp($tmpfile)) {
127
+ //it may be change
128
+ $helper->updateOptdata($tmpfile,$file);
129
+ }
130
+
131
+ if(!$helper->checkOptimize($file)) {
132
+ $return = $helper->optimize($file);
133
+ Mage::log($return);
134
+ }
135
+ }
136
+
137
+ }
138
+
139
+ public function getCronPeriodicity(){
140
+ $real_timedata = array(5, 10, 20, 30, 60, 120, 360, 720, 1440, 2880);
141
+ $period_data = array('5mins','10mins','20mins', '30min','1h','2h','6h','12h','24h','48h');
142
+ $i = 0;
143
+ $temp = Mage::getStoreConfig('mageio_cron_periodicity');
144
+ foreach($period_data as $period){
145
+ if($temp == $period)
146
+ return $real_timedata[$i];
147
+ $i++;
148
+ }
149
+ }
150
+ public function printdata($data){
151
+
152
+ $fp = fopen('d:/asd.txt', 'a');
153
+ fwrite($fp, $data);
154
+ fclose($fp);
155
+ }
156
+ public function onBackCheckOutAfter($observer){
157
+
158
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
159
+ echo $cutomer_email = $customer->getEmail();
160
+ $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
161
+ exit;
162
+
163
+ }
164
+
165
+ public function categorySaved($observer) {
166
+
167
+ $flag = Mage::getStoreConfig('mageio_saving_auto');
168
+ if(!$flag) return;
169
+
170
+ $categoryId = $observer->getEvent()->getCategory()->getId();
171
+ $model = Mage::getModel('catalog/category');
172
+ $category = $model->load($categoryId);
173
+ $image = $category->getImage();
174
+ $thumbnail = $category->getThumbnail();
175
+
176
+ include_once(__DIR__.'/../Helper/Data.php');
177
+ $helper = new Imagerecycle_Imagerecycle_Helper_Data();
178
+ $baseMedia = 'media';
179
+ if($image!='') {
180
+ $file = $baseMedia .'/catalog/category/'. $image;
181
+ if(!$helper->checkOptimize($file)) {
182
+ $return = $helper->optimize($file);
183
+ Mage::log($return);
184
+ }
185
+ }
186
+ if($thumbnail!='') {
187
+ $file = $baseMedia .'/catalog/category/'. $thumbnail;
188
+ if(!$helper->checkOptimize($file)) {
189
+ $return = $helper->optimize($file);
190
+ Mage::log($return);
191
+ }
192
+ }
193
+ }
194
+
195
+
196
+ }
197
  ?>
app/code/community/Imagerecycle/Imagerecycle/Model/Resource/Images.php CHANGED
@@ -1,6 +1,6 @@
1
- <?php
2
- Class Imagerecycle_Imagerecycle_Model_Resource_Images extends Mage_Core_Model_Resource_Db_Abstract{
3
- protected function _construct(){
4
- $this->_init('imagerecycle/images', 'id');
5
- }
6
  }
1
+ <?php
2
+ Class Imagerecycle_Imagerecycle_Model_Resource_Images extends Mage_Core_Model_Resource_Db_Abstract{
3
+ protected function _construct(){
4
+ $this->_init('imagerecycle/images', 'id');
5
+ }
6
  }
app/code/community/Imagerecycle/Imagerecycle/Model/Resource/Images/Collection.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- Class Imagerecycle_Weblog_Model_Resource_Blogpost_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract{
3
- protected function _construct(){
4
- $this->_init('weblog/blogpost');
5
- }
6
- }
 
 
 
 
 
 
app/code/community/Imagerecycle/Imagerecycle/Model/Resource/Setup.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
- Class Imagerecycle_Imagerecycle_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup{
3
-
4
- }
1
+ <?php
2
+ Class Imagerecycle_Imagerecycle_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup{
3
+
4
+ }
app/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php CHANGED
@@ -1,221 +1,271 @@
1
- <?php
2
- class ioaphp {
3
- /**
4
- * Authentication values array
5
- * @var array
6
- */
7
- protected $auth = array();
8
-
9
- /**
10
- * Image Optimize API Url
11
- * @var string api url
12
- */
13
- protected $apiUrl = 'https://api.imagerecycle.com/v1/';
14
-
15
- /**
16
- * Last Error message
17
- * @var string
18
- */
19
- protected $lastError = null;
20
-
21
-
22
- /**
23
- *
24
- * @param string $key
25
- * @param string $secret
26
- */
27
- public function __construct($key,$secret){
28
- $this->auth = array('key'=>$key, 'secret'=>$secret);
29
- }
30
-
31
- /**
32
- * Change the API URL
33
- * @param string $url
34
- */
35
- public function setAPIUrl($url){
36
- $this->apiUrl = $url;
37
- }
38
-
39
- /**
40
- * Upload a file sent through an html post form
41
- * @param $_FILES $file posted file
42
- */
43
- public function uploadFile($file,$params=array()){
44
- if(class_exists('CURLFile')){
45
- $curlFile = new CURLFile($file);
46
- }else{
47
- $curlFile = '@'.$file;
48
- }
49
-
50
- $params = array(
51
- 'auth' => json_encode($this->auth),
52
- 'file' => $curlFile,
53
- 'params' => json_encode( $params)
54
- );
55
-
56
- try {
57
- $result = $this->callAPI($this->apiUrl.'images/','POST',$params);
58
-
59
- } catch (Exception $exc) {
60
- $this->lastError = $exc->getMessage();
61
- return $this->lastError;// false;
62
- }
63
-
64
- return $result;
65
- }
66
-
67
- /**
68
- * Upload a file from an url
69
- * @param string $url
70
- * @return Object
71
- */
72
- public function uploadUrl($url,$params=array()){
73
- $params = array(
74
- 'auth' => json_encode($this->auth),
75
- 'url' => $url,
76
- 'params' => json_encode($params)
77
- );
78
- try {
79
- $result = $this->callAPI($this->apiUrl.'images/','POST',$params);
80
- } catch (Exception $exc) {
81
- $this->lastError = $exc->getMessage();
82
- return false;
83
- }
84
- return $result;
85
- }
86
-
87
- /**
88
- * Call the API with curl
89
- * @param string $url
90
- * @param string $type HTTP method
91
- * @param array $datas
92
- * @return type
93
- */
94
- protected function callAPI($url,$type,$datas){
95
- $curl = curl_init();
96
- curl_setopt($curl, CURLOPT_HEADER, 0);
97
- curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 100);
98
- curl_setopt($curl, CURLOPT_TIMEOUT, 100);
99
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
100
- curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $type);
101
- //fix windows localhost ssl problem
102
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
103
-
104
- if($type==='POST'){
105
- curl_setopt($curl, CURLOPT_POSTFIELDS, $datas);
106
- }else{
107
- $url .= '?'.http_build_query($datas);
108
- }
109
-
110
- curl_setopt($curl, CURLOPT_URL, $url);
111
- $content = curl_exec($curl);
112
- $infos = curl_getinfo($curl);
113
- $infos['http_code'] = (String)$infos['http_code'];
114
-
115
- if($infos['http_code'][0]!=='2'){
116
- $error = json_decode($content);
117
- if(isset($error->errCode)){
118
- $errCode = $error->errCode;
119
- }else{
120
- $errCode = 0;
121
- }
122
- if(isset($error->errMessage)){
123
- $errMessage = $error->errMessage;
124
- }else{
125
- $errMessage = 'An error occurs';
126
- }
127
- throw new Exception($errMessage,$errCode);
128
- }
129
- curl_close($curl);
130
- return json_decode($content);
131
- }
132
-
133
- /**
134
- * Get all the images
135
- * @return type
136
- */
137
- public function getImagesList($offset=0, $limit=30){
138
- $params = array(
139
- 'auth' => json_encode($this->auth),
140
- 'params' => '',
141
- 'offset' => $offset,
142
- 'limit' => $limit
143
- );
144
-
145
- try {
146
- $result = $this->callAPI($this->apiUrl.'images/','GET',$params);
147
- } catch (Exception $exc) {
148
- $this->lastError = $exc->getMessage();
149
- return false;
150
- }
151
- return $result;
152
- }
153
-
154
- /**
155
- * Get one image
156
- * @param int $id
157
- * @return type
158
- */
159
- public function getImage($id){
160
- $params = array(
161
- 'auth' => json_encode($this->auth),
162
- 'params' => ''
163
- );
164
-
165
- try {
166
- $result = $this->callAPI($this->apiUrl.'images/'.(int)$id,'GET',$params);
167
- } catch (Exception $exc) {
168
- $this->lastError = $exc->getMessage();
169
- return false;
170
- }
171
- return $result;
172
- }
173
-
174
- /**
175
- * Delete an image
176
- * @param int $id
177
- * @return type
178
- */
179
- public function deleteImage($id){
180
- $params = array(
181
- 'auth' => json_encode($this->auth),
182
- 'params' => ''
183
- );
184
-
185
- try {
186
- $result = $this->callAPI($this->apiUrl.'images/'.(int)$id,'DELETE',$params);
187
- } catch (Exception $exc) {
188
- $this->lastError = $exc->getMessage();
189
- return false;
190
- }
191
- return $result;
192
- }
193
-
194
- /**
195
- * Get account information
196
- * @return type
197
- */
198
- public function getAccountInfos(){
199
- $params = array(
200
- 'auth' => json_encode($this->auth),
201
- 'params' => ''
202
- );
203
-
204
- try {
205
- $result = $this->callAPI($this->apiUrl.'accounts/mine','GET',$params);
206
- } catch (Exception $exc) {
207
- $this->lastError = $exc->getMessage();
208
- return false;
209
- }
210
- return $result;
211
- }
212
-
213
- /**
214
- * Get last error message
215
- * @return string
216
- */
217
- public function getLastError(){
218
- return $this->lastError;
219
- }
220
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  ?>
1
+ <?php
2
+ class ioaphp {
3
+ /**
4
+ * Authentication values array
5
+ * @var array
6
+ */
7
+ protected $auth = array();
8
+
9
+ /**
10
+ * Image Optimize API Url
11
+ * @var string api url
12
+ */
13
+ protected $apiUrl = 'https://api.imagerecycle.com/v1/';
14
+
15
+ /**
16
+ * Last Error message
17
+ * @var string
18
+ */
19
+ protected $lastError = null;
20
+
21
+
22
+ /**
23
+ *
24
+ * @param string $key
25
+ * @param string $secret
26
+ */
27
+ public function __construct($key,$secret){
28
+
29
+ $this->auth = array('key'=>$key, 'secret'=>$secret);
30
+ }
31
+
32
+ /**
33
+ * Change the API URL
34
+ * @param string $url
35
+ */
36
+ public function setAPIUrl($url){
37
+ $this->apiUrl = $url;
38
+ }
39
+
40
+ /**
41
+ * Upload a file sent through an html post form
42
+ * @param $_FILES $file posted file
43
+ */
44
+ public function uploadFile($file,$params=array()){
45
+ if(class_exists('CURLFile')){
46
+ $curlFile = new CURLFile($file);
47
+ }else{
48
+ $curlFile = '@'.$file;
49
+ }
50
+
51
+ $params = array(
52
+ 'auth' => json_encode($this->auth),
53
+ 'file' => $curlFile,
54
+ 'params' => json_encode( $params)
55
+ );
56
+
57
+ try {
58
+ $result = $this->callAPI($this->apiUrl.'images/','POST',$params);
59
+
60
+ } catch (Exception $exc) {
61
+ $this->lastError = $exc->getMessage();
62
+ return $this->lastError;// false;
63
+ }
64
+
65
+ return $result;
66
+ }
67
+
68
+ /**
69
+ * Upload a file from an url
70
+ * @param string $url
71
+ * @return Object
72
+ */
73
+ public function uploadUrl($url,$params=array()){
74
+ $params = array(
75
+ 'auth' => json_encode($this->auth),
76
+ 'url' => $url,
77
+ 'params' => json_encode($params)
78
+ );
79
+ try {
80
+ $result = $this->callAPI($this->apiUrl.'images/','POST',$params);
81
+ } catch (Exception $exc) {
82
+ $this->lastError = $exc->getMessage();
83
+ return false;
84
+ }
85
+ return $result;
86
+ }
87
+
88
+ public function headRequest($url,$data) {
89
+
90
+ if( function_exists('curl_version')) {
91
+
92
+ $ch = curl_init();
93
+ curl_setopt ($ch, CURLOPT_URL, $url);
94
+ curl_setopt($ch, CURLOPT_POST, 1);
95
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //send the dat
96
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
97
+ curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); //TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
98
+ curl_setopt ($ch, CURLOPT_URL, $url); //The URL to fetch. This can also be set when initializing a session with curl_init().
99
+ curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 20);//The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.
100
+ curl_setopt ($ch, CURLOPT_TIMEOUT_MS, 1000); //The number of milliseconds to wait while trying to connect. Use 0 to wait indefinitely. If libcurl is built to use the standard system name resolver, that portion of the connect will still use full-second resolution for timeouts with a minimum timeout allowed of one second.
101
+ curl_setopt ($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // The contents of the "User-Agent: " header to be used in a HTTP request.
102
+
103
+ $content = curl_exec ($ch);
104
+ curl_close ($ch);
105
+ return $content;
106
+ }else {
107
+
108
+ $ctx = stream_context_create(
109
+ array('http'=>
110
+ array(
111
+ 'timeout' => 1,
112
+ )
113
+ )
114
+ );
115
+ echo file_get_contents($url, false, $ctx);
116
+ }
117
+ }
118
+
119
+
120
+ /**
121
+ * Call the API with curl
122
+ * @param string $url
123
+ * @param string $type HTTP method
124
+ * @param array $datas
125
+ * @return type
126
+ */
127
+ protected function callAPI($url,$type,$datas){
128
+ $curl = curl_init();
129
+ curl_setopt($curl, CURLOPT_HEADER, 0);
130
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 100);
131
+ curl_setopt($curl, CURLOPT_TIMEOUT, 100);
132
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
133
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $type);
134
+ //fix windows localhost ssl problem
135
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
136
+
137
+ if($type==='POST'){
138
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $datas);
139
+ }else{
140
+ $url .= '?'.http_build_query($datas);
141
+ }
142
+
143
+ curl_setopt($curl, CURLOPT_URL, $url);
144
+ $content = curl_exec($curl);
145
+ $infos = curl_getinfo($curl);
146
+ $infos['http_code'] = (String)$infos['http_code'];
147
+
148
+ if($infos['http_code'][0]!=='2'){
149
+ $error = json_decode($content);
150
+ if(isset($error->errCode)){
151
+ $errCode = $error->errCode;
152
+ }else{
153
+ $errCode = 0;
154
+ }
155
+ if(isset($error->errMessage)){
156
+ $errMessage = $error->errMessage;
157
+ }else{
158
+ $errMessage = 'An error occurs';
159
+ }
160
+ throw new Exception($errMessage,$errCode);
161
+ }
162
+ curl_close($curl);
163
+ return json_decode($content);
164
+ }
165
+
166
+ /**
167
+ * Get all the images
168
+ * @return type
169
+ */
170
+ public function getImagesList($offset=0, $limit=30){
171
+ $params = array(
172
+ 'auth' => json_encode($this->auth),
173
+ 'params' => '',
174
+ 'offset' => $offset,
175
+ 'limit' => $limit
176
+ );
177
+
178
+ try {
179
+ $result = $this->callAPI($this->apiUrl.'images/','GET',$params);
180
+ } catch (Exception $exc) {
181
+ $this->lastError = $exc->getMessage();
182
+ return false;
183
+ }
184
+ return $result;
185
+ }
186
+
187
+ /**
188
+ * Get one image
189
+ * @param int $id
190
+ * @return type
191
+ */
192
+ public function getImage($id){
193
+ $params = array(
194
+ 'auth' => json_encode($this->auth),
195
+ 'params' => ''
196
+ );
197
+
198
+ try {
199
+ $result = $this->callAPI($this->apiUrl.'images/'.(int)$id,'GET',$params);
200
+ } catch (Exception $exc) {
201
+ $this->lastError = $exc->getMessage();
202
+ return false;
203
+ }
204
+ return $result;
205
+ }
206
+
207
+ /**
208
+ * Delete an image
209
+ * @param int $id
210
+ * @return type
211
+ */
212
+ public function deleteImage($id){
213
+ $params = array(
214
+ 'auth' => json_encode($this->auth),
215
+ 'params' => ''
216
+ );
217
+
218
+ try {
219
+ $result = $this->callAPI($this->apiUrl.'images/'.(int)$id,'DELETE',$params);
220
+ } catch (Exception $exc) {
221
+ $this->lastError = $exc->getMessage();
222
+ return false;
223
+ }
224
+ return $result;
225
+ }
226
+
227
+ /**
228
+ * Get account information
229
+ * @return type
230
+ */
231
+ public function getAccountInfos(){
232
+
233
+ $params = array(
234
+ 'auth' => json_encode($this->auth),
235
+ 'params' => ''
236
+ );
237
+ try {
238
+ $result = $this->callAPI($this->apiUrl.'accounts/mine','GET',$params);
239
+ } catch (Exception $exc) {
240
+
241
+ $this->lastError = $exc->getMessage();
242
+ return false;
243
+ }
244
+ return $result;
245
+ }
246
+
247
+ /**
248
+ * Get last error message
249
+ * @return string
250
+ */
251
+ public function getLastError(){
252
+ return $this->lastError;
253
+ }
254
+
255
+ /*test the database*/
256
+ public function getData(){
257
+ /**
258
+ * Get the table name
259
+ */
260
+ $resourceR = Mage::getSingleton('core/resource')->getConnection('core_read');
261
+ $tableName = $resourceR->getTableName('a/imagerecycle');
262
+
263
+ var_dump($tableName);
264
+ exit(1);
265
+
266
+ }
267
+ }
268
+
269
+
270
+
271
  ?>
app/code/community/Imagerecycle/Imagerecycle/controllers/ImageAllController.php ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Imagerecycle_Imagerecycle_ImageAllController extends Mage_Core_Controller_Front_Action {
3
+
4
+ public function indexAction() {
5
+ $id = $this->getRequest()->getParam('id');
6
+ if($id == 'cronurl')
7
+ {
8
+ if( Mage::getStoreConfig('mageio_compress_auto')){
9
+ $now = time();
10
+ if(Mage::getStoreConfig('mageio_autosettig') == 'On')
11
+ {
12
+ $ao_lastRun = Mage::getStoreConfig('mageio_runtime');
13
+ $diff = $now - $ao_lastRun;
14
+ if($now - $ao_lastRun < 8000 ) {
15
+ exit;
16
+ }
17
+ }
18
+ $coreConfig = Mage::getConfig();
19
+ $coreConfig->saveConfig("mageio_autosettig", Mage::helper('core')->escapeHtml('On'));
20
+ $coreConfig->saveConfig("mageio_runtime", Mage::helper('core')->escapeHtml($now));
21
+ $coreConfig->cleanCache();
22
+ }
23
+
24
+ }
25
+ else{
26
+ if(Mage::getstoreConfig('mageio_OptResponse') != 'On'){
27
+ echo 'You cannot access!!!';
28
+ exit;
29
+ }
30
+ $this->setStatus('mageio_OptResponse', 'Off');
31
+ }
32
+ $this->initsetting();
33
+ $this->image_auto_optimize();
34
+ }
35
+
36
+ public function initsetting(){
37
+ $this->allowed_ext = array('jpg', 'jpeg', 'png', 'gif','pdf');
38
+ $this->ignoredPath = array('app', 'var', 'cache', 'adminhtml', '.', '..');
39
+ $this->allowedPath = "";
40
+
41
+ $this->totalImages = 0;//
42
+ $this->totalFile = 0;//
43
+ $this->time_elapsed_secs = 0;//
44
+ $this->totalOptimizedImages = 0; //
45
+
46
+ $resource = Mage::getSingleton('core/resource');
47
+ $this->settings = array(
48
+ 'api_key' =>Mage::getStoreConfig('mageio_api_key'),
49
+ 'api_secret' => Mage::getStoreConfig('mageio_api_secret'),
50
+ 'installed_time' => Mage::getStoreConfig('mageio_installed_time'),
51
+ 'include_folders' => Mage::getStoreConfig('mageio_include_folders'),
52
+ 'resize_auto' =>Mage::getStoreConfig('mageio_resize_auto'),
53
+ 'resize_image' => Mage::getStoreConfig('mageio_resize_image'),
54
+ 'min_size' => Mage::getStoreConfig('mageio_min_size'),
55
+ 'max_size' => Mage::getStoreConfig('mageio_max_size'),
56
+ 'compression_type_pdf' =>Mage::getStoreConfig('mageio_compression_type_pdf'),
57
+ 'compression_type_png' => Mage::getStoreConfig('mageio_compression_type_png'),
58
+ 'compression_type_jpg' => Mage::getStoreConfig('mageio_compression_type_jpg'),
59
+ 'compression_type_jpeg' => Mage::getStoreConfig('mageio_compression_type_jpeg'),
60
+ 'compression_type_gif' => Mage::getStoreConfig('mageio_compression_type_gif')
61
+ );
62
+
63
+ if(empty($this->settings['compression_type']) ) { $this->settings['compression_type'] = 'lossy'; }
64
+
65
+ $this->allowedPath = explode(',',$this->settings['include_folders']);
66
+
67
+
68
+ for($i=0;$i<count($this->allowed_ext); $i++) {
69
+ $compression_type = $this->settings['compression_type_'.$this->allowed_ext[$i]];
70
+ if($compression_type=="none") {
71
+ unset($this->allowed_ext[$i]);
72
+ }
73
+ }
74
+ $this->allowed_ext = array_values($this->allowed_ext);
75
+
76
+ }
77
+
78
+ /*
79
+ Get the local images
80
+ @magento database name
81
+ @magento table name
82
+ */
83
+ public function _getLocalImages() {
84
+ $optimizedFiles = array();
85
+ $resourceR = $this->getCoreRead('imagerecycle/images');
86
+
87
+ $sql = "SELECT file,size_before FROM `{$resourceR->tableName}` where `extension` = '1'";
88
+ $optimizedFiles = $resourceR->fetchAssoc($sql);
89
+ $this->totalOptimizedImages = count($optimizedFiles);
90
+
91
+ $min_size = isset($this->settings['min_size']) ? (int)$this->settings['min_size']*1024 : 1* 1024;
92
+ $max_size = !empty($this->settings['max_size']) ? (int)$this->settings['max_size'] * 1024 : 10000 * 1024;
93
+ $images = array();
94
+
95
+ if(Mage::getStoreConfig('mageio_include_folders') == '')
96
+ $base_dir = Mage::getBaseDir();
97
+ else
98
+ $base_dir = Mage::getBaseDir().DIRECTORY_SEPARATOR;
99
+ $start = microtime(true);
100
+ clearstatcache(); $counter = 0;
101
+ foreach($this->allowedPath as $base){
102
+ $base = $base_dir . $base;
103
+
104
+ if (!file_exists($base)) {
105
+ continue;
106
+ }
107
+ foreach (new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($base)) as $filename) {
108
+ $continue = false;
109
+ $this->totalFile++;
110
+
111
+ foreach ($this->ignoredPath as $ignore_path) {// must customize
112
+ $ignore_path = DIRECTORY_SEPARATOR . $ignore_path . DIRECTORY_SEPARATOR;
113
+ if (strpos(substr($filename, strlen($base)), $ignore_path) === 0 || strpos(substr($filename, strlen($base)), DIRECTORY_SEPARATOR . 'adminhtml' . DIRECTORY_SEPARATOR) !== FALSE) {
114
+ $continue = true;
115
+ continue;
116
+ }
117
+ }
118
+
119
+ if ($continue === true) {
120
+ continue;
121
+ }
122
+ if (!in_array(strtolower(pathinfo($filename, PATHINFO_EXTENSION)), $this->allowed_ext)) {
123
+ continue;
124
+ }
125
+ if(filesize($filename) < $min_size || filesize($filename) > $max_size ) {
126
+ continue;
127
+ }
128
+
129
+ $data = array();
130
+
131
+ if(Mage::getStoreConfig('mageio_include_folders') == ''){
132
+ $data['filename'] = str_replace('\\', '/', substr($filename, strlen($base_dir) + 1));
133
+ }
134
+ else{
135
+ $data['filename'] = str_replace('\\', '/', substr($filename, strlen($base_dir)));
136
+ }
137
+
138
+ $data['size'] = filesize($filename);
139
+ $data['filetype'] = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
140
+
141
+ $filter_name = Mage::getStoreConfig('mageio_all_filter_name');
142
+ $filter_type = Mage::getStoreConfig('mageio_all_filter_type');
143
+
144
+ if($filter_name || $filter_type)
145
+ {
146
+ $pos = strpos($data['filename'], $filter_name);
147
+ if($pos === false){
148
+ continue;
149
+ }
150
+
151
+ if($filter_type)
152
+ {
153
+ if($data['filetype'] !== $filter_type) continue;
154
+ }
155
+ }
156
+ if (isset($optimizedFiles[$data['filename']]) ) {
157
+
158
+ $data['optimized'] = true;
159
+ $data['optimized_datas'] = $optimizedFiles[$data['filename']];
160
+ }
161
+ else{
162
+ $data['optimized'] = false;
163
+ }
164
+ $this->totalImages++;
165
+ $images[] = $data; $counter++;
166
+ }
167
+ }
168
+
169
+ $this->time_elapsed_secs = microtime(true) - $start;
170
+ return $images;
171
+ }
172
+
173
+ /**
174
+ * image auto optimize
175
+ * @param void
176
+ */
177
+ public function image_auto_optimize()
178
+ {
179
+ ignore_user_abort(true);
180
+ $returned = -1;
181
+ $images = $this->_getLocalImages();
182
+ if(empty($images)) {
183
+ $this->setStatus('mageio_autosettig', 'Off');
184
+ $this->setStatus('mageio_runtime', null);
185
+ $this->setStatus('mageio_optfailure', '8');
186
+
187
+ $this->setStatus('filter_type', Mage::getStoreConfig('mageio_all_filter_type'));
188
+ $this->setStatus('filter_name', Mage::getStoreConfig('mageio_all_filter_name'));
189
+ return;
190
+ }
191
+ include_once( Mage::getBaseDir('app').'/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php');
192
+ foreach ($images as $image) {
193
+ if ($image['optimized'] === false) {
194
+ $now = time();
195
+
196
+ Mage::app()->getConfig()->reinit();
197
+ Mage::app()->getCacheInstance()->cleanType('config');
198
+ Mage::app()->reinitStores();
199
+ if(Mage::getstoreConfig('mageio_autosettig') == 'Off')
200
+ {
201
+ $this->setStatus('mageio_runtime', null);
202
+ break;
203
+ }
204
+ $this->setStatus( 'mageio_runtime' ,$now);
205
+ $returned = $this->optimize($image['filename']);
206
+ if($returned){
207
+
208
+ $this->setStatus('mageio_optfailure', $returned);
209
+ $this->setStatus('mageio_autosettig', 'Off');
210
+ $this->setStatus('mageio_runtime', null);
211
+ return;
212
+ }
213
+ }
214
+ }
215
+ // Now the optimize is ended.
216
+ $this->setStatus('mageio_autosettig', 'Off');
217
+ $this->setStatus('mageio_runtime', null);
218
+ $this->setStatus('mageio_optfailure', $returned);
219
+
220
+ $temp = Mage::getStoreConfig('mageio_all_filter_type');
221
+ $this->setStatus('filter_type',$temp);
222
+
223
+ Mage::app()->getConfig()->reinit();
224
+ Mage::app()->getCacheInstance()->cleanType('config');
225
+ Mage::app()->reinitStores();
226
+
227
+ $temp = Mage::getStoreConfig('mageio_all_filter_name');
228
+ $this->setStatus('filter_name', $temp);
229
+ return;
230
+
231
+ }
232
+
233
+ /***************************************************
234
+ * Optimize the files
235
+ return 1 if success or 0
236
+ *
237
+ ****************************************************/
238
+ public function optimize($image, $savePath='') {
239
+
240
+ $file = realpath($image);
241
+ if (!in_array(strtolower(pathinfo($file, PATHINFO_EXTENSION)), $this->allowed_ext )) {
242
+ return(6);
243
+ }
244
+ if (!file_exists($file)) {
245
+ //if file is in the database
246
+ return(1);
247
+ }
248
+ $resourceW = $this->getCoreWrite('imagerecycle/images');
249
+ $ext = substr($file, strrpos($file, '.')+1);
250
+ $compressionType= $this->settings['compression_type_'.$ext];
251
+ if($compressionType=='none') return;
252
+
253
+ if (!$this->settings['api_key'] || !$this->settings['api_secret'] )
254
+ {
255
+ return(2);
256
+ }
257
+ $fparams = array("compression_type"=> $compressionType);
258
+ $resize_image = $this->settings['resize_image'];
259
+ $resize_auto = $this->settings['resize_auto'];
260
+ if($resize_image && $resize_auto) {
261
+
262
+ $size = @getimagesize($file);
263
+ if($size && ($size[0]> $resize_image) ) {
264
+ $fparams['resize'] = array("width"=> $resize_image);
265
+ }
266
+ }
267
+ include_once( Mage::getBaseDir('app').'/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php');
268
+ $ioa = new ioaphp($this->settings['api_key'], $this->settings['api_secret']);
269
+ $return = $ioa->uploadFile($file,$fparams);
270
+
271
+ if ($return === false || $return === null || is_string($return)) {
272
+ $this->checkError();
273
+ return(3);
274
+ }
275
+ $coreConfig = Mage::getConfig();
276
+ $coreConfig->saveConfig("mageio_errormessage", Mage::helper('core')->escapeHtml(null))->cleanCache();
277
+ Mage::dispatchEvent('imagerecycle_notifications_before');
278
+
279
+ $md5 = md5_file($file);
280
+ clearstatcache();
281
+ $sizebefore = filesize($file);
282
+ $optimizedFileContent = $this->getContent($return->optimized_url);
283
+ if ($optimizedFileContent === false) {
284
+ return(4);
285
+ }
286
+
287
+ if (file_put_contents($file, $optimizedFileContent) === false) {
288
+ return(5);
289
+ }
290
+ clearstatcache();
291
+ $size_after = filesize($file);
292
+ if($savePath=='') { $savePath = $image;}
293
+
294
+ $id = $resourceW->fetchOne("SELECT id FROM {$resourceW->tableName} WHERE `file` = " . $resourceW->quote($savePath));
295
+ if (!$id) {
296
+
297
+ $name = substr($file, strrpos($file, "/")+1);
298
+ $ext = substr($name, strrpos($name, ".")+1);
299
+ $name = substr($name, 0, strrpos($name, '.'));
300
+
301
+ $resourceW->query("INSERT INTO `{$resourceW->tableName}` (`file`,`md5`,`api_id`,`size_before`, `size_after`,`date`,`name`, `ext`) VALUES ("
302
+ . $resourceW->quote($savePath) . "," . $resourceW->quote($md5) . "," . $resourceW->quote($return->id) . "," . (int) $sizebefore . "," . (int) $size_after . ",'" . date('Y-m-d H:i:s'). "',". $resourceW->quote($name). ",".$resourceW->quote($ext) .")");
303
+ }
304
+ else {
305
+ $resourceW->query("UPDATE `{$resourceW->tableName}` SET `extension` ='1',`api_id` =". $resourceW->quote($return->id) .", `md5` =".$resourceW->quote($md5)." , `size_after` = " . (int) $size_after .",`date` = '".date('Y-m-d H:i:s') . "' WHERE `id` = " . $resourceW->quote($id));
306
+ }
307
+ return(0);
308
+ }
309
+
310
+ /**
311
+ * Get content of specified resource via curl or file_get_content() function
312
+ */
313
+ protected function checkError(){
314
+ $coreConfig = Mage::getConfig();
315
+ $count = Mage::getStoreConfig('mageio_lasterror');
316
+ $count++;
317
+ if($count >= 3){
318
+ $coreConfig->saveConfig("mageio_saving_auto", Mage::helper('core')->escapeHtml('0'));
319
+ $coreConfig->saveConfig("mageio_compress_auto", Mage::helper('core')->escapeHtml('0'));
320
+ $coreConfig->saveConfig("mageio_errormessage", Mage::helper('core')->escapeHtml('on'));
321
+ Mage::dispatchEvent('imagerecycle_notifications_before');
322
+ $count = 0;
323
+ }
324
+ $coreConfig->saveConfig("mageio_lasterror", Mage::helper('core')->escapeHtml($count));
325
+ $coreConfig->cleanCache();
326
+ }
327
+
328
+ protected function getContent($url) {
329
+ if ($url == '') {
330
+ return '';
331
+ }
332
+ if (!function_exists('curl_version')) {
333
+ if (!$content = @file_get_contents($url)) {
334
+ return '';
335
+ }
336
+ } else {
337
+ $options = array(
338
+ CURLOPT_RETURNTRANSFER => true, // return content
339
+ CURLOPT_FOLLOWLOCATION => true, // follow redirects
340
+ CURLOPT_AUTOREFERER => true, // set referer on redirect
341
+ CURLOPT_CONNECTTIMEOUT => 60, // timeout on connect
342
+ CURLOPT_SSL_VERIFYPEER => false // Disabled SSL Cert checks
343
+ );
344
+ $ch = curl_init($url);
345
+ curl_setopt_array($ch, $options);
346
+ $content = curl_exec($ch);
347
+ curl_close($ch);
348
+ }
349
+
350
+ return $content;
351
+ }
352
+
353
+ public function setStatus($mage_key, $val){
354
+ $coreConfig = Mage::getConfig();
355
+ $coreConfig->saveConfig($mage_key, Mage::helper('core')->escapeHtml($val))->cleanCache();
356
+ }
357
+ public function getCoreWrite($entityId) {
358
+ $resource = Mage::getSingleton('core/resource');
359
+ $resourceW = $resource->getConnection('core_write');
360
+ $tableName = $resource->getTableName($entityId);
361
+ $resourceW->tableName = $tableName;
362
+ return $resourceW;
363
+ }
364
+ public function getCoreRead($entityId) {
365
+ $resource = Mage::getSingleton('core/resource');
366
+ $resourceR = $resource->getConnection('core_read');
367
+ $tableName = $resource->getTableName($entityId);
368
+ $resourceR->tableName = $tableName;
369
+ return $resourceR;
370
+ }
371
+
372
+ }
373
+ class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator {
374
+ function getChildren() {
375
+ try {
376
+ return new IgnorantRecursiveDirectoryIterator($this->getPathname());
377
+ } catch (UnexpectedValueException $e) {
378
+ return new RecursiveArrayIterator(array());
379
+ }
380
+ }
381
+ }
app/code/community/Imagerecycle/Imagerecycle/controllers/IndexController.php CHANGED
@@ -1,166 +1,317 @@
1
- <?php
2
-
3
- Class Imagerecycle_Imagerecycle_IndexController extends Mage_Adminhtml_Controller_Action {
4
-
5
- public function indexAction() {
6
- $this->_title($this->__('Image Recycle'));
7
- $this->_initAction()->renderLayout();
8
- return $this;
9
- }
10
-
11
- /**
12
- * Initialize action
13
- *
14
- * @return Mage_Adminhtml_Controller_Action
15
- */
16
- protected function _initAction() {
17
-
18
- $this->loadLayout()->_setActiveMenu('imagerecycle');
19
-
20
- return $this;
21
- }
22
-
23
- public function saveConfigAction() {
24
-
25
- $response = new stdClass();
26
- $response->success = false;
27
- $configKey = array('api_key', 'api_secret','exclude_folders','resize_auto',
28
- 'resize_image','min_size','max_size','compression_type_pdf','compression_type_png','compression_type_jpg','compression_type_gif');
29
- $coreConfig = Mage::getConfig();
30
- $post = $this->getRequest()->getPost();
31
- // var_dump($post);
32
- foreach ($configKey as $key) {
33
- if (isset($post[$key])) {
34
- $coreConfig->saveConfig("mageio_".$key, Mage::helper('core')->escapeHtml($post[$key]));
35
- $response->success = true;
36
- }
37
- }
38
- $installed_time = Mage::getStoreConfig('mageio_installed_time');
39
- if(empty($installed_time)) {
40
- $installed_time = time();
41
- $coreConfig = Mage::getConfig();
42
- $coreConfig->saveConfig('mageio_installed_time', $installed_time);
43
- }
44
-
45
- $cache = Mage::getSingleton('core/cache');
46
- $cache->flush();
47
- $response->msg = "All modifications were saved!";
48
- exit(json_encode($response));
49
- }
50
-
51
- public function revertAction() {
52
- $requestParams = $this->getRequest()->getParams();
53
- $image = isset($requestParams['image']) ? $requestParams['image'] : "";
54
- $return_params = array();
55
- if (isset($requestParams['page'])) {
56
- $return_params['page'] = $requestParams['page'];
57
- }
58
-
59
- //Include ioaphp class once
60
- include_once(Mage::getModuleDir('', 'Imagerecycle_Imagerecycle') . '/classes/ioa.class.php');
61
-
62
- $this->blockImages = $this->getLayout()->createBlock('imagerecycle/images');
63
- $returned = $this->_revert($image);
64
- $this->ajaxReponse($returned->status, $returned);
65
-
66
- }
67
-
68
- protected function _revert($image) {
69
-
70
- $response = new stdClass();
71
- $response->status = false;
72
- $response->msg = Mage::helper('imagerecycle')->__('Not be reverted yet');
73
-
74
- $resourceR = $this->blockImages->getCoreRead('imagerecycle/images');
75
- $resourceW = $this->blockImages->getCoreWrite('imagerecycle/images');
76
-
77
- $api_id = $resourceR->fetchOne("SELECT api_id FROM {$resourceR->tableName} WHERE `file` = " . $resourceR->quote($image));
78
- if ($api_id) {
79
-
80
- $ioa = new ioaphp($this->blockImages->settings['api_key'], $this->blockImages->settings['api_secret']);
81
- $return = $ioa->getImage($api_id);
82
-
83
- if (!isset($return->id)) {
84
- $response->msg = Mage::helper('imagerecycle')->__('api id is not correct');
85
- return $response;
86
- }
87
-
88
- $fileContent = file_get_contents($return->origin_url);
89
- if ($fileContent === false) {
90
- $response->msg = Mage::helper('imagerecycle')->__('Image not found');
91
- return $response;
92
- }
93
-
94
- $file = realpath($image);
95
- if (file_put_contents($file, $fileContent) === false) {
96
- $response->msg = Mage::helper('imagerecycle')->__("Can't write file");
97
- return $response;
98
- }
99
- clearstatcache();
100
- $size_after = filesize($file);
101
-
102
- $where = "api_id = " . $api_id;
103
- $result = $resourceW->delete($resourceW->tableName, $where);
104
- if ($result === false) {
105
- $response->msg = Mage::helper('imagerecycle')->__("Can't delete db record");
106
- return $response;
107
- }
108
-
109
- $response->newSize = number_format($size_after/1000, 2, '.', '') ;
110
- $response->status = true;
111
- $response->msg = Mage::helper('imagerecycle')->__('Reverted');
112
- }
113
- return $response;
114
- }
115
-
116
- public function optimizeAction() {
117
- $requestParams = $this->getRequest()->getParams();
118
- $image = isset($requestParams['image']) ? $requestParams['image'] : '';
119
- $return_params = array();
120
- if (isset($requestParams['page'])) {
121
- $return_params['page'] = $requestParams['page'];
122
- }
123
-
124
- //Include ioaphp class once
125
- include_once(Mage::getModuleDir('', 'Imagerecycle_Imagerecycle') . '/classes/ioa.class.php');
126
- $this->blockImages = $this->getLayout()->createBlock('imagerecycle/images');
127
-
128
- include_once(__DIR__.'/../Helper/Data.php');
129
- $helper = new Imagerecycle_Imagerecycle_Helper_Data();
130
- $returned = $helper->optimize($image);
131
- $this->ajaxReponse($returned->status, $returned);
132
- }
133
-
134
- /**
135
- * Be careful of this action if site has a very big amount of images
136
- */
137
- protected function optimizeAllAction() {
138
- $steps = 2;
139
- $this->blockImages = $this->getLayout()->createBlock('imagerecycle/images');
140
- $images = $this->blockImages->_getLocalImages();
141
- include_once(__DIR__.'/../Helper/Data.php');
142
- $helper = new Imagerecycle_Imagerecycle_Helper_Data();
143
-
144
- foreach ($images as $image) {
145
- if ($image['optimized'] === false) {
146
- if ($steps === 0) {
147
- $this->ajaxReponse(true, array('continue' => true, 'totalImages' => $this->blockImages->getTotalImages(), 'totalOptimizedImages' => $this->blockImages->getTotalOptimizedImages()));
148
- }
149
-
150
- $returned = $helper->optimize($image['filename']);
151
- if ($returned === false) {
152
- $this->ajaxReponse(false);
153
- }
154
- $steps--;
155
- }
156
- }
157
- }
158
-
159
- protected function ajaxReponse($status, $datas = null) {
160
- $response = array('status' => $status, 'datas' => $datas);
161
- echo json_encode($response);
162
- die();
163
- }
164
-
165
-
166
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ Class Imagerecycle_Imagerecycle_IndexController extends Mage_Adminhtml_Controller_Action {
4
+
5
+ public function indexAction() {
6
+ $this->_title($this->__('Image Recycle'));
7
+ $this->_initAction()->renderLayout();
8
+ return $this;
9
+ }
10
+ protected function checkIndexImage()
11
+ {
12
+ $reindexinit = Mage::getStoreConfig('mageio_reindex_init');
13
+ if($reindexinit){
14
+ $now = time();
15
+ $indextime = Mage::getStoreConfig('mageio_indextime');
16
+ $reindexinit *= 60;
17
+ $diff = $now - $indextime;
18
+ if($diff < $reindexinit)
19
+ return;
20
+ $coreConfig = Mage::getConfig();
21
+ $coreConfig->saveConfig('mageio_loadimage', Mage::helper('core')->escapeHtml(null));
22
+ $coreConfig->saveConfig('mageio_indextime', $now);
23
+ $coreConfig->cleanCache();
24
+ }
25
+
26
+ }
27
+ public function installNewVersion7(){
28
+ $this->blockImages = $this->getLayout()->createBlock('imagerecycle/images');
29
+ $this->blockImages->alterversion();
30
+
31
+ $coreConfig = Mage::getConfig();
32
+ $coreConfig->saveConfig('mageio_reindex_init', Mage::helper('core')->escapeHtml('720'));
33
+ $coreConfig->saveConfig('mageio_include_folders', Mage::helper('core')->escapeHtml('media,skin'));
34
+ $coreConfig->saveConfig('mageio_imagerecycle', Mage::helper('core')->escapeHtml('1.7.0'));
35
+ $coreConfig->cleanCache();
36
+
37
+ }
38
+
39
+ protected function _initAction() {
40
+
41
+ $this->loadLayout()->_setActiveMenu('imagerecycle');
42
+ include_once(__DIR__.'/../Helper/Data.php');
43
+ $helper = new Imagerecycle_Imagerecycle_Helper_Data();
44
+
45
+ $coreConfig = Mage::getConfig();
46
+ $coreConfig->saveConfig('mageio_lasterror', Mage::helper('core')->escapeHtml('0'))->cleanCache();
47
+
48
+ //first register if not
49
+ $returned = Mage::getStoreConfig('mageio_imagerecycle');
50
+ if(!$returned){
51
+ $this->installNewVersion7();
52
+ }
53
+
54
+ //set the reindex times logic
55
+ $this->checkIndexImage();
56
+ $returned = Mage::getStoreConfig('mageio_loadimage');
57
+ if(!$returned){
58
+ //database insert and upda
59
+ $this->blockImages = $this->getLayout()->createBlock('imagerecycle/images');
60
+ $this->blockImages->_getLocalImages();
61
+ }
62
+
63
+ if(Mage::getstoreConfig('mageio_autosettig') == 'On')
64
+ {
65
+ $last_optime = Mage::getStoreConfig('mageio_runtime');
66
+ $cur_time = time();
67
+ if(($cur_time - $last_optime) > 60){
68
+ $coreConfig->saveConfig('mageio_autosettig', Mage::helper('core')->escapeHtml('Off'));
69
+ $coreConfig->saveConfig('mageio_runtime', null);
70
+ $coreConfig->cleanCache();
71
+ }
72
+ }
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Save saveConfig in settins
78
+ *
79
+ */
80
+ public function saveSettingAction(){
81
+ $configKey = array('api_key', 'api_secret','include_folders','resize_auto',
82
+ 'resize_image','min_size','max_size','compression_type_pdf','compression_type_png','compression_type_jpg','compression_type_gif', 'saving_auto', 'compress_auto', 'cron_periodicity', 'reindex_init');
83
+ $coreConfig = Mage::getConfig();
84
+ $post = $this->getRequest()->getPost();
85
+ foreach ($configKey as $key) {
86
+ if (isset($post[$key])) {
87
+ $coreConfig->saveConfig("mageio_".$key, Mage::helper('core')->escapeHtml($post[$key]))->cleanCache();
88
+ }
89
+ }
90
+ $installed_time = Mage::getStoreConfig('mageio_installed_time');
91
+ if(empty($installed_time)) {
92
+ $installed_time = time();
93
+ $coreConfig = Mage::getConfig();
94
+ $coreConfig->saveConfig('mageio_installed_time', Mage::helper('core')->escapeHtml($installed_time))->cleanCache();
95
+ }
96
+ //Remove error message if set
97
+ $coreConfig->saveConfig("mageio_errormessage", Mage::helper('core')->escapeHtml(null))->cleanCache();
98
+
99
+ $this->_redirect('imagerecycle/index/index');
100
+ }
101
+
102
+ public function saveconfigAction() {
103
+ $this->loadLayout();
104
+ $this->renderLayout();
105
+ }
106
+
107
+ public function reindexInitAction() {
108
+ //rescan the database
109
+ $this->blockImages = $this->getLayout()->createBlock('imagerecycle/images');
110
+ $this->blockImages->_getLocalImages();
111
+
112
+ $now = time();
113
+ $coreConfig = Mage::getConfig();
114
+ $coreConfig->saveConfig('mageio_loadimage', Mage::helper('core')->escapeHtml(null));
115
+ $coreConfig->saveConfig('mageio_indextime', $now);
116
+ $coreConfig->cleanCache();
117
+ $this->ajaxReponse(true);
118
+ }
119
+
120
+ public function getStatusAction(){
121
+
122
+ $this->blockImages = $this->getLayout()->createBlock('imagerecycle/images');
123
+ $optimizedCount = $this->blockImages->getOptimizedImages()+1;
124
+ Mage::app()->getConfig()->reinit();
125
+ Mage::app()->getCacheInstance()->cleanType('config');
126
+ Mage::app()->reinitStores();
127
+
128
+ if(Mage::getStoreConfig('mageio_autosettig') == 'On')
129
+ $op_status = 'On';
130
+ else{
131
+
132
+ $op_status = Mage::getStoreConfig('mageio_runtime');
133
+ if($op_status) $op_status = 'On';
134
+ else $op_status = 'Off';
135
+ }
136
+
137
+ $this->ajaxReponse(true ,array('optimizedCount'=>$optimizedCount,'op_status'=>$op_status));
138
+ }
139
+
140
+ /* *
141
+ ***set search-filter-condition in saveConfig
142
+ * */
143
+ public function setConfigAction() {
144
+ $response = new stdClass();
145
+ $response->success = false;
146
+ $coreConfig = Mage::getConfig();
147
+ $post = $this->getRequest()->getPost();
148
+ $coreConfig->saveConfig('filter_type', Mage::helper('core')->escapeHtml($post['filter_type']));
149
+ $coreConfig->saveConfig('filter_name', Mage::helper('core')->escapeHtml($post['filter_name']));
150
+ $coreConfig->saveConfig('filter_status', Mage::helper('core')->escapeHtml($post['filter_status']));
151
+ $coreConfig->cleanCache();
152
+
153
+ $response->success = true;
154
+ $cache = Mage::getSingleton('core/cache');
155
+ $cache->flush();
156
+ exit(json_encode($response));
157
+ }
158
+
159
+ /*
160
+ * Revert processing
161
+ * @Return ajaxReponse
162
+ */
163
+ public function revertAction() {
164
+ $requestParams = $this->getRequest()->getParams();
165
+ $image = isset($requestParams['image']) ? $requestParams['image'] : "";
166
+ $return_params = array();
167
+ if (isset($requestParams['page'])) {
168
+ $return_params['page'] = $requestParams['page'];
169
+ }
170
+ //Include ioaphp class once
171
+ include_once(Mage::getModuleDir('', 'Imagerecycle_Imagerecycle') . '/classes/ioa.class.php');
172
+ $this->blockImages = $this->getLayout()->createBlock('imagerecycle/images');
173
+ include_once(__DIR__.'/../Helper/Data.php');
174
+ $helper = new Imagerecycle_Imagerecycle_Helper_Data();
175
+ $returned = $helper->_revert($image);
176
+ $this->ajaxReponse($returned->status, $returned);
177
+ }
178
+
179
+ public function optimizeAction() {
180
+
181
+ $requestParams = $this->getRequest()->getParams();
182
+ $image = isset($requestParams['image']) ? $requestParams['image'] : '';
183
+ $return_params = array();
184
+ if (isset($requestParams['page'])) {
185
+ $return_params['page'] = $requestParams['page'];
186
+ }
187
+ include_once(Mage::getModuleDir('', 'Imagerecycle_Imagerecycle') . '/classes/ioa.class.php');
188
+ $this->blockImages = $this->getLayout()->createBlock('imagerecycle/images');
189
+
190
+ include_once(__DIR__.'/../Helper/Data.php');
191
+ $helper = new Imagerecycle_Imagerecycle_Helper_Data();
192
+ $returned = $helper->optimize($image);
193
+ $this->ajaxReponse($returned->status, $returned);
194
+ }
195
+
196
+ /**
197
+ * Be careful of this action if site has a very big amount of images
198
+ */
199
+ protected function stopOptimizeAllAction() {
200
+ $coreConfig = Mage::getConfig();
201
+ $coreConfig->saveConfig("mageio_autosettig", Mage::helper('core')->escapeHtml('Off'))->cleanCache();
202
+ $this->ajaxReponse(false);
203
+ }
204
+
205
+ protected function clearstatusAction() {
206
+ $coreConfig = Mage::getConfig();
207
+ $coreConfig->saveConfig('mageio_optfailure', Mage::helper('core')->escapeHtml(''))->cleanCache();
208
+ $this->ajaxReponse(true);
209
+ }
210
+
211
+ protected function optimizeAllAction() {
212
+
213
+ $now = time();
214
+ if(Mage::getStoreConfig('mageio_autosettig') == 'On')
215
+ {
216
+ $ao_lastRun = Mage::getStoreConfig('mageio_runtime');
217
+ if($now - $ao_lastRun < 60 ) {
218
+ $this->ajaxReponse(true, array('continue' => true, 'starttime' => time(), 'status' => 'Continue'));
219
+ return;
220
+ }
221
+ }
222
+ $coreConfig = Mage::getConfig();
223
+ $coreConfig->saveConfig("mageio_autosettig", Mage::helper('core')->escapeHtml('On'));
224
+ $coreConfig->saveConfig("mageio_OptResponse", Mage::helper('core')->escapeHtml('On'));
225
+ $coreConfig->saveConfig("mageio_runtime", Mage::helper('core')->escapeHtml($now));
226
+
227
+ $requestParams = $this->getRequest()->getParams();
228
+ $coreConfig->saveConfig("mageio_all_filter_type", Mage::helper('core')->escapeHtml($requestParams['filter_type']));
229
+ $coreConfig->saveConfig("mageio_all_filter_name", Mage::helper('core')->escapeHtml($requestParams['filter_name']));
230
+ $coreConfig->cleanCache();
231
+
232
+ $this->headRequest();
233
+
234
+ $this->ajaxReponse(true, array('starttime' => time()));
235
+ }
236
+
237
+ protected function saveAccountAction(){
238
+ $requestParams = $this->getRequest()->getParams();
239
+ $apikey = $requestParams['apikey'];
240
+ $secret = $requestParams['secret'];
241
+ $coreConfig = Mage::getConfig();
242
+ $coreConfig->saveConfig("mageio_api_secret", Mage::helper('core')->escapeHtml($secret));
243
+ $coreConfig->saveConfig("mageio_api_key", Mage::helper('core')->escapeHtml($apikey));
244
+ $coreConfig->cleanCache();
245
+
246
+ $this->ajaxReponse(true);
247
+ }
248
+
249
+ protected function headRequest(){
250
+ if( function_exists('curl_version')) {
251
+ $ch = curl_init();
252
+ $url = Mage::getBaseUrl().'imagerecycle/ImageAll/index';
253
+ curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
254
+ curl_setopt ($ch, CURLOPT_URL, $url);
255
+ curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 20);
256
+ curl_setopt ($ch, CURLOPT_TIMEOUT_MS, 1000);
257
+ // Only calling the head
258
+ curl_setopt($ch, CURLOPT_HEADER, true); // header will be at output
259
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD'
260
+ $content = curl_exec ($ch);
261
+ curl_close ($ch);
262
+ }else {
263
+ return;
264
+ }
265
+ }
266
+ protected function ajaxReponse($status, $datas = null) {
267
+ $response = array('status' => $status, 'datas' => $datas);
268
+ echo json_encode($response);
269
+ die();
270
+ }
271
+
272
+ protected function getFoldersAction()
273
+ {
274
+ Mage::app()->getConfig()->reinit();
275
+ Mage::app()->getCacheInstance()->cleanType('config');
276
+ Mage::app()->reinitStores();
277
+ $include_folders = Mage::getStoreConfig('mageio_include_folders');
278
+ $selected_folders = explode(',', $include_folders);
279
+ $path = Mage::getBaseDir().DIRECTORY_SEPARATOR;
280
+ $requestParams = $this->getRequest()->getParams();
281
+ $dir = $requestParams['dir'];
282
+
283
+ $return = $dirs = array();
284
+ if(file_exists($path.$dir) ) {
285
+ $files = scandir($path.$dir);
286
+ natcasesort($files);
287
+ if( count($files) > 2 ) {
288
+ $baseDir = ltrim(rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $dir),'/'),'/');
289
+ if($baseDir != '') $baseDir .= '/';
290
+ foreach( $files as $file ) {
291
+ if( file_exists($path . $dir . DIRECTORY_SEPARATOR . $file) && $file != '.' && $file != '..' && is_dir($path . $dir. DIRECTORY_SEPARATOR . $file) ) {
292
+
293
+ if(in_array( $baseDir .$file,$selected_folders) ) {
294
+ $dirs[] = array('type'=>'dir','dir'=>$dir,'file'=>$file,'checked'=>true);
295
+ }else {
296
+ $hasSubFolderSelected = false;
297
+ foreach ($selected_folders as $selected_folder) {
298
+ if(strpos($selected_folder,$baseDir .$file)=== 0) {
299
+ $hasSubFolderSelected = true;
300
+ }
301
+ }
302
+ if($hasSubFolderSelected) {
303
+ $dirs[] = array('type'=>'dir','dir'=>$dir,'file'=>$file,'pchecked'=>true);
304
+ }else {
305
+ $dirs[] = array('type'=>'dir','dir'=>$dir,'file'=>$file);
306
+ }
307
+ }
308
+ }
309
+ }
310
+ $return = $dirs;
311
+ }
312
+ }
313
+ echo json_encode( $return );
314
+ die();
315
+ }
316
+
317
+ }
app/code/community/Imagerecycle/Imagerecycle/etc/adminhtml.xml CHANGED
@@ -1,14 +1,14 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <menu>
4
- <system>
5
- <children>
6
- <Imagerecycle_Index translate="title" module="imagerecycle">
7
- <title>Image Recycle</title>
8
- <action>imagerecycle/Index</action>
9
- </Imagerecycle_Index>
10
- </children>
11
- </system>
12
- </menu>
13
-
14
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <system>
5
+ <children>
6
+ <Imagerecycle_Index translate="title" module="imagerecycle">
7
+ <title>Image Recycle</title>
8
+ <action>imagerecycle/Index</action>
9
+ </Imagerecycle_Index>
10
+ </children>
11
+ </system>
12
+ </menu>
13
+
14
+ </config>
app/code/community/Imagerecycle/Imagerecycle/etc/config.xml CHANGED
@@ -26,8 +26,32 @@
26
  </imagerecycle_imagerecycle>
27
  </updates>
28
  </layout>
 
 
 
 
 
 
 
 
 
 
 
29
  </adminhtml>
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  <global>
32
  <models>
33
  <imagerecycle>
@@ -74,6 +98,25 @@
74
  </observers>
75
  </catalog_category_save_commit_after>
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  </events>
78
  <resources>
79
  <imagerecycle_setup>
@@ -87,6 +130,7 @@
87
  <blocks>
88
  <imagerecycle>
89
  <class>Imagerecycle_Imagerecycle_Block</class>
 
90
  </imagerecycle>
91
  <core>
92
  <rewrite>
26
  </imagerecycle_imagerecycle>
27
  </updates>
28
  </layout>
29
+ <events>
30
+ <adminhtml_sales_order_create_process_data>
31
+ <observers>
32
+ <imagerecycle_imagerecycle_model_observer>
33
+ <type>singleton</type>
34
+ <class>Imagerecycle_Imagerecycle_Model_Observer</class>
35
+ <method>onBackCheckOutAfter</method>
36
+ </imagerecycle_imagerecycle_model_observer>
37
+ </observers>
38
+ </adminhtml_sales_order_create_process_data>
39
+ </events>
40
  </adminhtml>
41
 
42
+ <crontab>
43
+ <jobs>
44
+ <imagerecycle_imagerecycle>
45
+ <schedule>
46
+ <cron_expr>*/5 * * * *</cron_expr>
47
+ </schedule>
48
+ <run>
49
+ <model>imagerecycle/observer::cronexec</model>
50
+ </run>
51
+ </imagerecycle_imagerecycle>
52
+ </jobs>
53
+ </crontab>
54
+
55
  <global>
56
  <models>
57
  <imagerecycle>
98
  </observers>
99
  </catalog_category_save_commit_after>
100
 
101
+ <controller_action_layout_render_before>
102
+ <observers>
103
+ <imagerecycle_imagerecycle_model_observer>
104
+ <type>singleton</type>
105
+ <class>Imagerecycle_Imagerecycle_Model_Observer</class>
106
+ <method>checkResponse</method>
107
+ </imagerecycle_imagerecycle_model_observer>
108
+ </observers>
109
+ </controller_action_layout_render_before>
110
+
111
+ <imagerecycle_notifications_before>
112
+ <observers>
113
+ <imagerecycle_imagerecycle_model_observer>
114
+ <type>singleton</type>
115
+ <class>Imagerecycle_Imagerecycle_Model_Observer</class>
116
+ <method>checkMessages</method>
117
+ </imagerecycle_imagerecycle_model_observer>
118
+ </observers>
119
+ </imagerecycle_notifications_before>
120
  </events>
121
  <resources>
122
  <imagerecycle_setup>
130
  <blocks>
131
  <imagerecycle>
132
  <class>Imagerecycle_Imagerecycle_Block</class>
133
+
134
  </imagerecycle>
135
  <core>
136
  <rewrite>
app/code/community/Imagerecycle/Imagerecycle/sql/imagerecycle_setup/mysql4-install-1.0.0.php CHANGED
@@ -1,19 +1,21 @@
1
- <?php
2
-
3
- $installer = $this;
4
- $installer->startSetup();
5
- $installer->run("
6
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('imagerecycle/images')}` (
7
- `id` int(11) NOT NULL AUTO_INCREMENT,
8
- `file` varchar(250) NOT NULL,
9
- `md5` varchar(32) NOT NULL,
10
- `extension` VARCHAR(5) NOT NULL,
11
- `api_id` int(11) NOT NULL,
12
- `size_before` int(11) NOT NULL,
13
- `size_after` int(11) NOT NULL,
14
- `date` datetime NOT NULL,
15
- PRIMARY KEY (`id`)
16
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
17
- ");
18
-
 
 
19
  $installer->endSetup();
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+ $installer->run("
6
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('imagerecycle/images')}` (
7
+ `id` int(11) NOT NULL AUTO_INCREMENT,
8
+ `file` varchar(250) NOT NULL,
9
+ `md5` varchar(32) NOT NULL,
10
+ `extension` VARCHAR(5) NOT NULL,
11
+ `api_id` int(11) NOT NULL,
12
+ `size_before` int(11) NOT NULL,
13
+ `size_after` int(11) NOT NULL,
14
+ `date` datetime NOT NULL,
15
+ `name` varchar(250) NOT NULL,
16
+ `ext` varchar(250) NOT NULL,
17
+ PRIMARY KEY (`id`)
18
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
19
+ ");
20
+
21
  $installer->endSetup();
app/design/adminhtml/default/default/layout/imagerecycle_imagerecycle.xml CHANGED
@@ -1,13 +1,41 @@
1
- <?xml version="1.0"?>
2
- <layout>
3
- <imagerecycle_index_index>
4
- <reference name="content">
5
- <block type="imagerecycle/images" name="recycleimage" template="imagerecycle/imagerecycle/images.phtml" />
6
- </reference>
7
- <reference name="head">
8
- <action method="addJs"><script>imagerecycle/imagerecycle/jquery.min.js</script></action>
9
- <action method="addJs"><script>imagerecycle/imagerecycle/script.js</script></action>
10
- <action method="addCss"><name>imagerecycle/imagerecycle/imagerecycle.css</name></action>
11
- </reference>
12
- </imagerecycle_index_index>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  </layout>
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="notifications">
5
+ <block type="imagerecycle/notifications" name="notifications_imagerecycle" />
6
+ </reference>
7
+ </default>
8
+ <imagerecycle_index_index>
9
+ <reference name="content">
10
+ <block type="imagerecycle/images" name="recycleimage" template="imagerecycle/imagerecycle/images.phtml"/>
11
+ <block type="imagerecycle/images/connect" name="recycleimage_connect" template="imagerecycle/imagerecycle/connect.phtml"/>
12
+ </reference>
13
+ <reference name="head">
14
+ <action method="addJs"><script>imagerecycle/imagerecycle/jquery.min.js</script></action>
15
+ <action method="addJs"><script>imagerecycle/imagerecycle/script.js</script></action>
16
+ <action method="addJs"><script>imagerecycle/imagerecycle/thickbox.js</script></action>
17
+ <action method="addCss"><name>imagerecycle/imagerecycle/imagerecycle.css</name></action>
18
+ <action method="addCss"><name>imagerecycle/imagerecycle/thickbox.css</name></action>
19
+ </reference>
20
+ </imagerecycle_index_index>
21
+
22
+ <imagerecycle_index_saveconfig>
23
+ <reference name="content">
24
+ <block type="imagerecycle/settings" name="settingsimage" template="imagerecycle/imagerecycle/settings.phtml" />
25
+ </reference>
26
+
27
+ <reference name="head">
28
+ <action method="addJs"><script>imagerecycle/imagerecycle/jquery.min.js</script></action>
29
+ <action method="addJs"><script>imagerecycle/imagerecycle/jaofiletree.js</script></action>
30
+ <action method="addJs"><script>imagerecycle/imagerecycle/thickbox.js</script></action>
31
+ <action method="addJs"><script>imagerecycle/imagerecycle/jquery.reveal.js</script></action>
32
+ <action method="addJs"><script>imagerecycle/imagerecycle/config.js</script></action>
33
+ <action method="addCss"><name>imagerecycle/imagerecycle/imagerecycle.css</name></action>
34
+ <action method="addCss"><name>imagerecycle/imagerecycle/jaofiletree.css</name></action>
35
+ <action method="addCss"><name>imagerecycle/imagerecycle/thickbox.css</name></action>
36
+ <action method="addCss"><name>imagerecycle/imagerecycle/reveal.css</name></action>
37
+ </reference>
38
+ </imagerecycle_index_saveconfig>
39
+
40
+
41
  </layout>
app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/connect.phtml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!empty(Mage::getStoreConfig('mageio_api_secret')) && !empty(Mage::getStoreConfig('mageio_api_key'))){
3
+ return;
4
+ }
5
+ $user = Mage::getSingleton('admin/session');
6
+ $adminName = urlencode($user->getUser()->getUsername()); // adminname
7
+ $adminMail = urlencode($user->getUser()->getEmail()); //dadmin mail
8
+
9
+ $urlToCreateAccount = "https://www.imagerecycle.com/index.php?option=com_ioa&view=register&adminName={$adminName}&adminMail={$adminMail}&TB_iframe=true&width=600&height=550";
10
+ $urlToLoginAccount = "https://www.imagerecycle.com/index.php?option=com_ioa&view=register&layout=connect&TB_iframe=true&width=600&height=350";
11
+ ?>
12
+ <script>page="connect";</script>
13
+ <div class="main-presentation"
14
+ style="margin: 30px auto; max-width: 1200px; background-color:#f0f1f4;font-family: helvetica,arial,sans-serif;">
15
+ <div class="main-textcontent"
16
+ style="margin: 0px auto; min-height: 300px; border-left: 1px dotted #d2d3d5; border-right: 1px dotted #d2d3d5; width: 840px; background-color:#fff;border-top: 5px solid #544766;"
17
+ cellspacing="0" cellpadding="0" align="center">
18
+ <a href="https://www.imagerecycle.com/" target="_blank"> <img
19
+ src="https://www.imagerecycle.com/images/Notification-mail/logo-image-recycle.png"
20
+ alt="logo image recycle" width="500" height="84" class="CToWUd"
21
+ style="display: block; outline: medium none; text-decoration: none; margin-left: auto; margin-right: auto; margin-top:15px;">
22
+ </a>
23
+ <p style="background-color: #ffffff; color: #445566; font-family: helvetica,arial,sans-serif; font-size: 24px; line-height: 24px; padding-right: 10px; padding-left: 10px;"
24
+ align="center"><strong>Welcome on board!<br></strong></p>
25
+ <p style="background-color: #ffffff; color: #445566; font-family: helvetica,arial,sans-serif; font-size: 14px; line-height: 22px; padding-left: 20px; padding-right: 20px; text-align: center;">
26
+ ImageRecycle will help you to optimize automatically your website images &amp; PDF<br>In order to start
27
+ the optimization process, you can create in one click a 15 days free trial account<br>to use our
28
+ external hosted webservice.<br>This way, it will require less resources to your server.<br/>You can also
29
+ use existing credentials. Enjoy!</p>
30
+ <p></p>
31
+
32
+ <p>
33
+ <a style="width: 250px; float: left; background: #554766; font-size: 12px; line-height: 18px; text-align: center; margin-left:20px;color: #fff;font-size: 14px;text-decoration: none; text-transform: uppercase; padding: 8px 20px; font-weight:bold;"
34
+ href="<?php echo $urlToLoginAccount; ?>" class="thickbox">Use existing account</a></p>
35
+
36
+
37
+ <p>
38
+ <a style="width: 250px; float: right; background: #554766; font-size: 12px; line-height: 18px; text-align: center; margin-right:20px;color: #fff;font-size: 14px;text-decoration: none; text-transform: uppercase; padding: 8px 20px; font-weight:bold;"
39
+ href="<?php echo $urlToCreateAccount; ?>" class="thickbox">Create a trial account</a></p>
40
+
41
+ <p style="background-color: #ffffff; color: #445566; font-family: helvetica,arial,sans-serif; font-size: 24px; line-height: 24px; padding-right: 10px; padding-left: 10px; padding-top: 40px;"
42
+ align="center"><strong><br>Why ImageRecycle?<br></strong></p>
43
+ <p style="background-color: #ffffff; color: #445566; font-family: helvetica,arial,sans-serif; font-size: 14px; line-height: 22px; padding-left: 20px; padding-right: 20px; text-align: center;">
44
+ Images represent 60% to 70% of website page weight. Image optimization is good for your users and for
45
+ your server.<br> You won't find any other service that compress in the same time .pdf .jpeg and .png
46
+ images keeping the original quality. We are using a unique algorithm to achieve that. Each compression
47
+ script is executed on an optimized server to serve you as fast as possible.</p>
48
+ <p style="font-size: 130%;">
49
+ <a href="https://www.imagerecycle.com/plans/free-trial-plan?group_id=0" target="_blank">Free trial</a> -
50
+ <a href="https://www.imagerecycle.com/prices" target="_blank">Prices</a> -
51
+ <a href="https://www.imagerecycle.com/uploader" target="_blank">Uploader</a>
52
+ </p>
53
+ <p style="text-align: center; color: #9da2a8; font-size: 11px; line-height: 12px; padding: 15px;"><br> This
54
+ is a welcome screen to help you with ImageRecycle configuration. Once you have registered your API key
55
+ this message will no longer be displayed.<br><br><a href="https://www.facebook.com/imagerecycle"
56
+ target="_blank"><img
57
+ src="https://www.imagerecycle.com/images/Notification-mail/facebook.png" alt="facebook"
58
+ width="24" height="24" class="CToWUd"></a> &nbsp; <a href="https://twitter.com/ImageRecycle"
59
+ target="_blank" style="margin: 0 5px;"><img
60
+ src="https://www.imagerecycle.com/images/Notification-mail/twitter.png" alt="twitter" width="24"
61
+ height="24" class="CToWUd"></a> &nbsp; <a
62
+ href="https://plus.google.com/104235881525310825230/posts" target="_blank"><img
63
+ src="https://www.imagerecycle.com/images/Notification-mail/google.png" alt="google" width="24"
64
+ height="24" class="CToWUd"></a></p>
65
+ </div>
66
+ </div>
67
+
68
+ <script>
69
+ var autoaccount_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/saveAccount") ?>?isAjax=true';
70
+ </script>
app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/images.phtml CHANGED
@@ -1,371 +1,322 @@
1
- <?php
2
-
3
- // Images to show
4
- $images = $this->getImages();
5
- $totalImages = count($images);
6
- // Get current url without page param
7
- $requestParams = $this->getRequest()->getParams();
8
- if( isset($requestParams['page']) ){
9
- unset($requestParams['page']);
10
- }
11
- $order_by = isset($requestParams['order_by'])? $requestParams['order_by']: "" ;
12
- if(isset($requestParams['dir']) && $requestParams['dir']=='desc') {
13
- $dir = 'desc';
14
- $new_dir = 'asc';
15
- }else {
16
- $dir = 'asc';
17
- $new_dir = 'desc';
18
- }
19
-
20
- $url = Mage::helper("adminhtml")->getUrl("*/*/index");
21
- if($order_by != '') {
22
- $sortedUrl = $url . "order_by/".$order_by."/dir/".$dir.'/';
23
- }else {
24
- $sortedUrl = $url;
25
- }
26
-
27
- ?>
28
-
29
- <div class="content-header">
30
- <h3 class="icon-head" style="color: #009999">
31
- <?php echo Mage::helper('imagerecycle')->__('Images Recycle Manager') ?>
32
- </h3>
33
- </div>
34
-
35
- <div>
36
- <div style="float:right; margin-top: -45px; position: relative">
37
- <a id="ir-setting" href="javascript:void(0)">Setting<i class="icon-setting"></i></a>
38
- <div class="ir-setting hidden">
39
- <p style="margin-top: 8px; color: #6565cb; font-weight: bold"><?php echo Mage::helper('imagerecycle')->__('Image recycle setttings') ?></p>
40
- <table class="form-table">
41
- <tbody>
42
- <input id="installed_time" class="formData" name="_mageio_settings[installed_time]" type="hidden" value="<?php echo $this->settings['installed_time'] ; ?>" size="50"/>
43
- <tr>
44
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('API key : ') ?></th>
45
- <td colspan="2">
46
- <input id="api_key" class="formData" name="_mageio_settings[api_key]" type="text" value="<?php echo $this->escapeHtml($this->settings['api_key']) ; ?>" size="50"/>
47
- </td>
48
- </tr>
49
- <tr>
50
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('API secret : ') ?></th>
51
- <td colspan="2">
52
- <input id="api_secret" class="formData" name="_mageio_settings[api_secret]" type="text" value="<?php echo $this->escapeHtml($this->settings['api_secret']) ; ?>" size="50"/>
53
- </td>
54
- </tr>
55
- <tr>
56
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Exclude folders : ') ?></th>
57
- <td colspan="2">
58
- <?php $exclude_folders = !empty($this->settings['exclude_folders'])? $this->settings['exclude_folders']: "app,var,cache,adminhtml"; ?>
59
- <input id="exclude_folders" class="formData" name="_mageio_settings[exclude_folders]" type="text" value="<?php echo $this->escapeHtml($exclude_folders) ; ?>" size="50"/>
60
- </td>
61
- </tr>
62
- <tr>
63
- <th scope="row" ><?php echo Mage::helper('imagerecycle')->__('Image resize') ?></th>
64
- <td colspan="2">
65
- <?php
66
- $resize_auto = !is_null($this->settings['resize_auto'])? $this->settings['resize_auto']: 0;
67
- ?>
68
- <select id="resize_auto" name="_mageio_settings[resize_auto]">
69
- <option value="0" <?php if($resize_auto==0) { echo 'selected="selected"';}?> >No</option>
70
- <option value="1" <?php if($resize_auto==1) { echo 'selected="selected"';}?> >Yes</option>
71
- </select>
72
- </td>
73
- </tr>
74
- <tr>
75
- <td colspan="3">
76
- <?php echo Mage::helper('imagerecycle')->__('<strong>Use with caution!</strong> All new images will size more than setting will be resized automatically on upload') ?>
77
- </td>
78
- </tr>
79
- <tr>
80
- <th scope="row" colspan="2"><?php echo Mage::helper('imagerecycle')->__('Image resize, max size (px)') ?></th>
81
- <td>
82
- <?php $resize_image = !is_null($this->settings['resize_image'])?$this->settings['resize_image'] : 1600; ?>
83
- <input id="resize_image" class="formData" name="_mageio_settings[resize_image]" type="text" value="<?php echo $this->escapeHtml($resize_image) ; ?>" size="10"/>
84
- </td>
85
- </tr>
86
- <tr>
87
- <th scope="row" colspan="2">
88
- <?php echo Mage::helper('imagerecycle')->__('Min file size to optimize (Kb)') ?></th>
89
- <td>
90
- <?php $minSize = !is_null($this->settings['min_size'])?$this->settings['min_size'] : 1; ?>
91
- <input id="min_size" class="formData" name="_mageio_settings[min_size]" type="text" value="<?php echo $this->escapeHtml($minSize) ; ?>" size="10"/>
92
- </td>
93
- </th>
94
- </tr>
95
- <tr>
96
- <th scope="row" colspan="2">
97
- <?php echo Mage::helper('imagerecycle')->__('Max file size to optimize (Kb)') ?></th>
98
- <td>
99
- <?php $maxSize = !is_null($this->settings['max_size'])?$this->settings['max_size'] : 10000; ?>
100
- <input id="max_size" class="formData" name="_mageio_settings[max_size]" type="text" value="<?php echo $this->escapeHtml($maxSize) ; ?>" size="10"/>
101
- </td>
102
- </th>
103
- </tr>
104
- <tr>
105
- <th scope="row" colspan="2">
106
- <input id="compression_type" class="formData" name="_mageio_settings[compression_type]" type="hidden" value="lossy" size="50"/>
107
- <?php echo Mage::helper('imagerecycle')->__('Compression type - PDF:') ?> </th>
108
- <td>
109
- <select id="compression_type_pdf" class="formData" name="_mageio_settings[compression_type_pdf]" >
110
- <option value="lossy" <?php if($this->settings['compression_type_pdf']=='lossy') echo 'selected="selected"';?> >Best saving</option>
111
- <option value="lossless" <?php if($this->settings['compression_type_pdf']=='lossless') echo 'selected="selected"';?>>Original quality</option>
112
- <option value="none" <?php if($this->settings['compression_type_pdf']=='none') echo 'selected="selected"';?>>No compression</option>
113
- </select>
114
- </td>
115
- </th>
116
- </tr>
117
- <tr>
118
- <th scope="row" colspan="2">
119
- <?php echo Mage::helper('imagerecycle')->__('Compression type - PNG:') ?> </th>
120
- <td>
121
- <select id="compression_type_png" class="formData" name="_mageio_settings[compression_type_png]" >
122
- <option value="lossy" <?php if($this->settings['compression_type_png']=='lossy') echo 'selected="selected"';?> >Best saving</option>
123
- <option value="lossless" <?php if($this->settings['compression_type_png']=='lossless') echo 'selected="selected"';?>>Original quality</option>
124
- <option value="none" <?php if($this->settings['compression_type_png']=='none') echo 'selected="selected"';?>>No compression</option>
125
- </select>
126
- </td>
127
- </th>
128
- </tr>
129
- <tr>
130
- <th scope="row" colspan="2">
131
- <?php echo Mage::helper('imagerecycle')->__('Compression type - JPG:') ?> </th>
132
- <td>
133
- <select id="compression_type_jpg" class="formData" name="_mageio_settings[compression_type_jpg]" >
134
- <option value="lossy" <?php if($this->settings['compression_type_jpg']=='lossy') echo 'selected="selected"';?> >Best saving</option>
135
- <option value="lossless" <?php if($this->settings['compression_type_jpg']=='lossless') echo 'selected="selected"';?>>Original quality</option>
136
- <option value="none" <?php if($this->settings['compression_type_jpg']=='none') echo 'selected="selected"';?>>No compression</option>
137
- </select>
138
- </td>
139
- </th>
140
- </tr>
141
- <tr>
142
- <th scope="row" colspan="2">
143
- <?php echo Mage::helper('imagerecycle')->__('Compression type - GIF:') ?> </th>
144
- <td>
145
- <select id="compression_type_gif" class="formData" name="_mageio_settings[compression_type_gif]" >
146
- <option value="lossy" <?php if($this->settings['compression_type_gif']=='lossy') echo 'selected="selected"';?> >Best saving</option>
147
- <option value="lossless" <?php if($this->settings['compression_type_gif']=='lossless') echo 'selected="selected"';?>>Original quality</option>
148
- <option value="none" <?php if($this->settings['compression_type_gif']=='none') echo 'selected="selected"';?>>No compression</option>
149
- </select>
150
- </td>
151
- </th>
152
- </tr>
153
- <tr>
154
- <th scope="row"></th>
155
- <td width="50%" style="text-align:center">
156
- <a id="ir-setting-save" class="button ir-action" style="padding: 0 15px 1px" href="#"><?php echo Mage::helper('imagerecycle')->__('Save') ?>
157
- <span id="ir-setting-loader">
158
- <img src="<?php echo $this->getSkinUrl('images/ajax-loader-tr.gif') ?>" width="18px" height="18px" />
159
- </span>
160
- </a>
161
- <span id="ir-setting-msg"></span>
162
- </td>
163
- <td></td>
164
- </tr>
165
- </tbody>
166
- </table>
167
- </div>
168
- </div>
169
- <div class="scan-msg-box" style="display: none">
170
- <div>
171
- <p><?php echo Mage::helper('imagerecycle')->__("It may takes a few minutes for the first time of using Mage Image Recycle.") ?></p>
172
- <p>
173
- <?php echo Mage::helper('imagerecycle')->__("Images finder processing..") ?>
174
- </p>
175
- <p style="margin-top: 25px">
176
- <img class="ir-loader" src="<?php echo $this->getSkinUrl('images/ajax-loader-tr.gif') ?>" width="50" height="50" />
177
- <p class="ir-scan-msg"></p>
178
- </p>
179
- </div>
180
- </div>
181
-
182
- <form id="irForm" method="post" action="<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/optimize", array('page' => $this->page)) ?>">
183
- <p class="msg-warning bulk-action-error" style="display:none"><?php echo Mage::helper('imagerecycle')->__("Please select one Action") ?></p>
184
- <div class="clear-left"></div>
185
-
186
- <div class="row row1">
187
- <div style="float: left">
188
- <select class="ir-bulk-action" name="bulk_action">
189
- <option value="-1"><?php echo Mage::helper('imagerecycle')->__("Bulk Action") ?></option>
190
- <option value="optimize_selected"><?php echo Mage::helper('imagerecycle')->__("Optimize selsected") ?></option>
191
- <option value="optimize_all"><?php echo Mage::helper('imagerecycle')->__("Optimize all") ?></option>
192
- </select>
193
- <button class="button do-bulk-action"><?php echo Mage::helper('imagerecycle')->__("Apply") ?></button>
194
- </div>
195
-
196
- <div class="pagination-wrapper">
197
- <span style="float:left; margin-right: 8px; margin-top: 8px">
198
- <i>Total <?php echo (!$totalImages ? "0 item" : ($this->totalImages > 1 ? "$this->totalImages items" : "1 item")) ?></i>
199
- </span>
200
- <?php if($pagination = $this->pagination): ?>
201
- <ul class="pagination">
202
- <li class="<?php if ($this->page == $pagination->start): ?>disabled<?php endif ?>"><a href="<?php echo $sortedUrl . "page/$pagination->start" ?>">Start</a></li>
203
- <li class="<?php if ($this->page == $pagination->start): ?>disabled<?php endif ?>"><a href="<?php echo $sortedUrl . "page/$pagination->prev" ?>">Prev</a></li>
204
- <?php foreach($pagination->range as $page): ?>
205
- <li class="<?php if ($page == $pagination->current): ?>active<?php endif ?>"><a href="<?php echo $sortedUrl . "page/$page" ?>"><?php echo $page ?></a></li>
206
- <?php endforeach ?>
207
- <li class="<?php if ($this->page == $pagination->end): ?>disabled<?php endif ?>"><a href="<?php echo $sortedUrl . "page/$pagination->next" ?>">Next</a></li>
208
- <li class="<?php if ($this->page == $pagination->end): ?>disabled<?php endif ?>"><a href="<?php echo $sortedUrl . "page/$pagination->end" ?>">End</a></li>
209
- </ul>
210
- <?php endif ?>
211
- </div>
212
- </div>
213
-
214
- <table class="image-recycle">
215
- <thead>
216
- <tr>
217
- <th colspan="1" class="check-column"><input type="checkbox" class="ir-checkbox check-all" name="check_all" /></th>
218
- <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Image') ?></th>
219
- <th colspan="5">
220
- <?php if($order_by=='filename') :?>
221
- <a href="<?php echo $url . "order_by/filename/dir/".$new_dir;?>">
222
- <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
223
- <span class="<?php if($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
224
- <?php else:?>
225
- <a href="<?php echo $url . "order_by/filename/dir/asc";?>">
226
- <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
227
- </a>
228
- <?php endif ?>
229
-
230
- </th>
231
- <th colspan="2">
232
- <?php if($order_by=='size') :?>
233
- <a href="<?php echo $url . "order_by/size/dir/".$new_dir;?>">
234
- <?php echo Mage::helper('imagerecycle')->__('Size') ?>
235
- <span class="<?php if($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
236
- <?php else:?>
237
- <a href="<?php echo $url . "order_by/size/dir/asc";?>">
238
- <?php echo Mage::helper('imagerecycle')->__('Size') ?>
239
- </a>
240
- <?php endif ?>(Kb)
241
- </th>
242
- <th colspan="2">
243
- <?php if($order_by=='status') :?>
244
- <a href="<?php echo $url . "order_by/status/dir/".$new_dir;?>">
245
- <?php echo Mage::helper('imagerecycle')->__('Status') ?>
246
- <span class="<?php if($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
247
- <?php else:?>
248
- <a href="<?php echo $url . "order_by/status/dir/asc";?>">
249
- <?php echo Mage::helper('imagerecycle')->__('Status') ?>
250
- </a>
251
- <?php endif ?>
252
- </th>
253
- <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Action') ?></th>
254
- </tr>
255
- </thead>
256
- <tfoot>
257
- <tr>
258
- <th colspan="1" class="check-column"><input type="checkbox" class="ir-checkbox check-all" name="check_all" /></th>
259
- <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Image') ?></th>
260
- <th colspan="5">
261
- <?php if($order_by=='filename') :?>
262
- <a href="<?php echo $url . "order_by/filename/dir/".$new_dir;?>">
263
- <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
264
- <span class="<?php if($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
265
- <?php else:?>
266
- <a href="<?php echo $url . "order_by/filename/dir/asc";?>">
267
- <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
268
- </a>
269
- <?php endif ?>
270
-
271
- </th>
272
- <th colspan="2">
273
- <?php if($order_by=='size') :?>
274
- <a href="<?php echo $url . "order_by/size/dir/".$new_dir;?>">
275
- <?php echo Mage::helper('imagerecycle')->__('Size') ?>
276
- <span class="<?php if($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
277
- <?php else:?>
278
- <a href="<?php echo $url . "order_by/size/dir/asc";?>">
279
- <?php echo Mage::helper('imagerecycle')->__('Size') ?>
280
- </a>
281
- <?php endif ?>(Kb)
282
- </th>
283
- <th colspan="2">
284
- <?php if($order_by=='status') :?>
285
- <a href="<?php echo $url . "order_by/status/dir/".$new_dir;?>">
286
- <?php echo Mage::helper('imagerecycle')->__('Status') ?>
287
- <span class="<?php if($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
288
- <?php else:?>
289
- <a href="<?php echo $url . "order_by/status/dir/asc";?>">
290
- <?php echo Mage::helper('imagerecycle')->__('Status') ?>
291
- </a>
292
- <?php endif ?>
293
- </th>
294
- <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Action') ?></th>
295
- </tr>
296
- </tfoot>
297
- <tbody>
298
-
299
- <?php foreach($images as $k => $image): ;?>
300
- <?php if($k > 50) break; ?>
301
- <?php $alternate = ($k%2==0) ? 'even' : ''; ?>
302
- <tr class="<?php echo $alternate ?>">
303
- <th colspan="1" class="check-column">
304
- <input type="checkbox" value="<?php echo $image['filename'] ?>" name="images[]" class="ir-checkbox" />
305
- </th>
306
- <th colspan="2" class="item-image">
307
- <?php if($image['filetype']=='pdf') { ?>
308
- <img class="image-small" src="<?php echo $this->getBaseUrl();?>/skin/adminhtml/default/default/imagerecycle/imagerecycle/images/pdf.png" />
309
- <?php }else { ?>
310
- <img class="image-small" src="<?php echo $this->getBaseUrl().$image['filename'] ?>" />
311
- <img class="image-origin" src="<?php echo $this->getBaseUrl().$image['filename'] ?>" />
312
- <?php } ?>
313
- </th>
314
- <td colspan="5" style="font-size:14px"><?php echo $image['filename'] ?></td>
315
- <td colspan="2" style="font-size:15px"><span class="filesize"><?php echo number_format($image['size']/1000, 2, '.', ''); ?></span></td>
316
- <td colspan="2" class="ir-status">
317
- <?php if($image['optimized']) : $file = realpath($image['filename']); ?>
318
- <span class="optimizationStatus">Optimized at <?php echo round(($image['optimized_datas']['size_before']-filesize($file))/$image['optimized_datas']['size_before']*100,2);?>%</span>
319
- <?php endif; ?>
320
-
321
- </td>
322
- <td colspan="2">
323
- <?php if($image['optimized']) { ?>
324
- <a class="button revert ir-action" href="#" data-image-realpath="<?php echo $image['filename'] ?>"><?php echo Mage::helper('imagerecycle')->__('Revert to original') ?></a>
325
- <?php } else { ?>
326
- <a class="button optimize ir-action" href="#" data-image-realpath="<?php echo $image['filename'] ?>"><?php echo Mage::helper('imagerecycle')->__('Optimize') ?></a>
327
- <?php } ?>
328
- </td>
329
- </tr>
330
- <?php endforeach ?>
331
- </tbody>
332
- </table>
333
-
334
- <div class="row row2" style="margin-top: 15px; padding: 0">
335
- <div style="float: left">
336
- <select class="ir-bulk-action" name="bulk_action">
337
- <option value="-1"><?php echo Mage::helper('imagerecycle')->__("Bulk Action") ?></option>
338
- <option value="optimize_selected"><?php echo Mage::helper('imagerecycle')->__("Optimize selsected") ?></option>
339
- <option value="optimize_all"><?php echo Mage::helper('imagerecycle')->__("Optimize all") ?></option>
340
- </select>
341
- <button class="button do-bulk-action"><?php echo Mage::helper('imagerecycle')->__("Apply") ?></button>
342
- </div>
343
-
344
- <div class="pagination-wrapper">
345
- <span style="float:left; margin-right: 8px; margin-top: 8px">
346
- <i>Total <?php echo (!$totalImages ? "0 item" : ($this->totalImages > 1 ? "$this->totalImages items" : "1 item")) ?></i>
347
- </span>
348
- <?php if($pagination = $this->pagination): ?>
349
- <ul class="pagination">
350
- <li class="<?php if ($this->page == $pagination->start): ?>disabled<?php endif ?>"><a href="<?php echo $sortedUrl . "page/$pagination->start" ?>">Start</a></li>
351
- <li class="<?php if ($this->page == $pagination->start): ?>disabled<?php endif ?>"><a href="<?php echo $sortedUrl . "page/$pagination->prev" ?>">Prev</a></li>
352
- <?php foreach($pagination->range as $page): ?>
353
- <li class="<?php if ($page == $pagination->current): ?>active<?php endif ?>"><a href="<?php echo $sortedUrl . "page/$page" ?>"><?php echo $page ?></a></li>
354
- <?php endforeach ?>
355
- <li class="<?php if ($this->page == $pagination->end): ?>disabled<?php endif ?>"><a href="<?php echo $sortedUrl . "page/$pagination->next" ?>">Next</a></li>
356
- <li class="<?php if ($this->page == $pagination->end): ?>disabled<?php endif ?>"><a href="<?php echo $sortedUrl . "page/$pagination->end" ?>">End</a></li>
357
- </ul>
358
- <?php endif ?>
359
- </div>
360
- </div>
361
- <!-- Form_key is required -->
362
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
363
- </form>
364
- </div>
365
-
366
- <script type="text/javascript">
367
- var optimize_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/optimize") ?>';
368
- var optimizeall_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/optimizeAll") ?>';
369
- var revert_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/revert") ?>';
370
- var saveConfig_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/saveConfig") ?>?isAjax=true' ;
371
- </script>
1
+ <div class="imagerecycle-container">
2
+ <?php
3
+ if (empty(Mage::getStoreConfig('mageio_api_secret')) || empty(Mage::getStoreConfig('mageio_api_key'))) {
4
+ return;
5
+ }
6
+ ?>
7
+ <script>page="main";</script>
8
+ <div class="content-header">
9
+ <h3>
10
+ <?php echo Mage::helper('imagerecycle')->__('Images Recycle Manager') ?>
11
+ </h3>
12
+ </div>
13
+
14
+ <?php
15
+ Mage::app()->getConfig()->reinit();
16
+ Mage::app()->getCacheInstance()->cleanType('config');
17
+ Mage::app()->reinitStores();
18
+
19
+
20
+ $optimizeall_flag = Mage::getStoreConfig('mageio_autosettig');
21
+ $optimizedCount = Mage::getStoreConfig('mageio_optimizedImageCount');
22
+ $mageio_optfailure = Mage::getStoreConfig('mageio_optfailure');
23
+ $search_name = Mage::getStoreConfig('filter_name');
24
+ $search_type = Mage::getStoreConfig('filter_type');
25
+ $search_size = Mage::getStoreConfig('filter_size');
26
+ $search_status = Mage::getStoreConfig('filter_status');
27
+
28
+ $coreConfig = Mage::getConfig();
29
+ $coreConfig->saveConfig("filter_name", Mage::helper('core')->escapeHtml(''));
30
+ $coreConfig->saveConfig("filter_type", Mage::helper('core')->escapeHtml(''));
31
+ $coreConfig->saveConfig("filter_size", Mage::helper('core')->escapeHtml(''));
32
+ $coreConfig->saveConfig("filter_status", Mage::helper('core')->escapeHtml(''));
33
+ $coreConfig->cleanCache();
34
+
35
+ $images = $this->loadImage($search_name, $search_type, $search_size, $search_status);
36
+ $totalImages = count($images);
37
+ // Get current url without page param
38
+
39
+ $requestParams = $this->getRequest()->getParams();
40
+ if (isset($requestParams['page'])) {
41
+ unset($requestParams['page']);
42
+ }
43
+ $order_by = isset($requestParams['order_by']) ? $requestParams['order_by'] : "";
44
+ if (isset($requestParams['dir']) && $requestParams['dir'] == 'desc') {
45
+ $dir = 'desc';
46
+ $new_dir = 'asc';
47
+ } else {
48
+ $dir = 'asc';
49
+ $new_dir = 'desc';
50
+ }
51
+ $url = Mage::helper("adminhtml")->getUrl("*/*/index");
52
+ if ($order_by != '') {
53
+ $sortedUrl = $url . "order_by/" . $order_by . "/dir/" . $dir . '/';
54
+ } else {
55
+ $sortedUrl = $url;
56
+ }
57
+
58
+ ?>
59
+ <script type="text/javascript">
60
+
61
+ var getFolders_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/getFolders") ?>?isAjax=true';
62
+ var responseAjax_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/getStatus")?>?isAjax=true';
63
+ var search_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index") ?>';
64
+ var setConfig_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/setConfig") ?>?isAjax=true';
65
+ var clearstatus_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/clearstatus") ?>';
66
+ var optimize_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/optimize") ?>';
67
+ var stopoptimizeall_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/stopOptimizeAll") ?>';
68
+ var optimizeall_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/optimizeAll") ?>';
69
+ var revert_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/revert") ?>';
70
+ var totalimage = <?php echo $this->totalImages; ?>;
71
+ var optimizeall_flag = "<?php echo $optimizeall_flag; ?>";
72
+ </script>
73
+ <div>
74
+ <div class="ir-setting-group">
75
+ <a id="ir-setting" class="button"
76
+ href="<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/saveconfig") ?>">Setting<i
77
+ class="icon-setting"></i></a>
78
+ </div>
79
+
80
+ <form id="irForm" method="post"
81
+ action="<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/optimize", array('page' => $this->page)) ?>">
82
+ <p class="msg-warning bulk-action-error"
83
+ style="display:none"><?php echo Mage::helper('imagerecycle')->__("Please select one Action") ?></p>
84
+ <div class="clear-left"></div>
85
+ <div>
86
+ <select class="ir-bulk-action" name="bulk_action">
87
+ <option
88
+ value="optimize_selected"><?php echo Mage::helper('imagerecycle')->__("Optimize selected") ?></option>
89
+ <option
90
+ value="revert selected"><?php echo Mage::helper('imagerecycle')->__("Revert selected") ?></option>
91
+ </select>
92
+ <button
93
+ class="button do-bulk-action"><?php echo Mage::helper('imagerecycle')->__("Apply") ?></button>
94
+ <span class="image-recycle-label">OR</span>
95
+ <button
96
+ class="button do-optimize-all-action"><?php echo Mage::helper('imagerecycle')->__("Optimize all") ?></button>
97
+ <button style="display:none;" class="button stop-optimize-all-action"><?php echo Mage::helper('imagerecycle')->__("Stop optimize") ?></button>
98
+ <span class="display-time"></span>
99
+ </div>
100
+
101
+ <table class="image-recycle">
102
+ <thead>
103
+ <tr>
104
+ <th colspan="1" class="check-column"><input type="checkbox" class="ir-checkbox check-all"
105
+ name="check_all"/></th>
106
+ <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Image') ?></th>
107
+ <th colspan="5">
108
+ <?php if ($order_by == 'filename') : ?>
109
+ <a href="<?php echo $url . "order_by/filename/dir/" . $new_dir; ?>">
110
+ <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
111
+ <span
112
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
113
+ <?php else: ?>
114
+ <a href="<?php echo $url . "order_by/filename/dir/asc"; ?>">
115
+ <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
116
+ </a>
117
+ <?php endif ?>
118
+
119
+ </th>
120
+ <th colspan="2">
121
+ <?php if ($order_by == 'size') : ?>
122
+ <a href="<?php echo $url . "order_by/size/dir/" . $new_dir; ?>">
123
+ <?php echo Mage::helper('imagerecycle')->__('Size') ?>
124
+ <span
125
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
126
+ <?php else: ?>
127
+ <a href="<?php echo $url . "order_by/size/dir/asc"; ?>">
128
+ <?php echo Mage::helper('imagerecycle')->__('Size') ?>
129
+ </a>
130
+ <?php endif ?>(Kb)
131
+ </th>
132
+ <th colspan="2">
133
+ <?php if ($order_by == 'status') : ?>
134
+ <a href="<?php echo $url . "order_by/status/dir/" . $new_dir; ?>">
135
+ <?php echo Mage::helper('imagerecycle')->__('Status') ?>
136
+ <span
137
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
138
+ <?php else: ?>
139
+ <a href="<?php echo $url . "order_by/status/dir/asc"; ?>">
140
+ <?php echo Mage::helper('imagerecycle')->__('Status') ?>
141
+ </a>
142
+ <?php endif ?>
143
+ </th>
144
+ <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Action') ?></th>
145
+ </tr>
146
+ <tr class="filter">
147
+ <th colspan="1"></th>
148
+ <th colspan="2">
149
+ <select name="image_name" id="filter_type">
150
+ <option value="" <?php if ($search_type == "") { ?> selected <?php } ?>>All Type</option>
151
+ <option value="jpg" <?php if ($search_type == "jpg") { ?> selected <?php } ?>>JPG</option>
152
+ <option value="png" <?php if ($search_type == "png") { ?> selected <?php } ?>>PNG</option>
153
+ <option value="gif" <?php if ($search_type == "gif") { ?> selected <?php } ?>>GIF</option>
154
+ <option value="pdf" <?php if ($search_type == "pdf") { ?> selected <?php } ?>>PDF</option>
155
+ </select>
156
+ </th>
157
+ <th colspan="3">
158
+ <input name="name" id="filter_name"
159
+ value="<?php echo Mage::helper('imagerecycle')->__($search_name) ?>"
160
+ class="input-text" type="text"/>
161
+ <button class="do-search button" href="#"><?php echo Mage::helper('imagerecycle')->__('Search') ?></button>
162
+
163
+ </th>
164
+ <th colspan="2"></th>
165
+ <th colspan="2"></th>
166
+ <th colspan="2">
167
+ <select name="image_status" id="filter_status">
168
+ <option value="" <?php if ($search_status == "") { ?> selected <?php } ?>>All</option>
169
+ <option value="opt" <?php if ($search_status == "opt") { ?> selected <?php } ?>>Optimized
170
+ </option>
171
+ <option value="unopt" <?php if ($search_status == "unopt") { ?> selected <?php } ?>>not
172
+ optimized
173
+ </option>
174
+ </select>
175
+ </th>
176
+ <th colspan="2"></th>
177
+ </tr>
178
+ </thead>
179
+ <tfoot>
180
+ <tr>
181
+ <th colspan="1" class="check-column"><input type="checkbox" class="ir-checkbox check-all"
182
+ name="check_all"/></th>
183
+ <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Image') ?></th>
184
+ <th colspan="5">
185
+ <?php if ($order_by == 'filename') : ?>
186
+ <a href="<?php echo $url . "order_by/filename/dir/" . $new_dir; ?>">
187
+ <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
188
+ <span
189
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
190
+ <?php else: ?>
191
+ <a href="<?php echo $url . "order_by/filename/dir/asc"; ?>">
192
+ <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
193
+ </a>
194
+ <?php endif ?>
195
+
196
+ </th>
197
+ <th colspan="2">
198
+ <?php if ($order_by == 'size') : ?>
199
+ <a href="<?php echo $url . "order_by/size/dir/" . $new_dir; ?>">
200
+ <?php echo Mage::helper('imagerecycle')->__('Size') ?>
201
+ <span
202
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
203
+ <?php else: ?>
204
+ <a href="<?php echo $url . "order_by/size/dir/asc"; ?>">
205
+ <?php echo Mage::helper('imagerecycle')->__('Size') ?>
206
+ </a>
207
+ <?php endif ?>(Kb)
208
+ </th>
209
+ <th colspan="2">
210
+ <?php if ($order_by == 'status') : ?>
211
+ <a href="<?php echo $url . "order_by/status/dir/" . $new_dir; ?>">
212
+ <?php echo Mage::helper('imagerecycle')->__('Status') ?>
213
+ <span
214
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
215
+ <?php else: ?>
216
+ <a href="<?php echo $url . "order_by/status/dir/asc"; ?>">
217
+ <?php echo Mage::helper('imagerecycle')->__('Status') ?>
218
+ </a>
219
+ <?php endif ?>
220
+ </th>
221
+ <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Action') ?></th>
222
+ </tr>
223
+ </tfoot>
224
+ <tbody>
225
+
226
+ <?php
227
+
228
+ if ($totalImages) {
229
+ foreach ($images as $k => $image): ; ?>
230
+ <?php if ($k > 50) break; ?>
231
+ <?php $alternate = ($k % 2 == 0) ? 'even' : ''; ?>
232
+ <tr class="<?php echo $alternate ?>">
233
+ <th colspan="1" class="check-column">
234
+ <input type="checkbox" value="<?php echo $image['file'] ?>" name="images[]"
235
+ class="ir-checkbox"/>
236
+ </th>
237
+
238
+
239
+ <th colspan="2" class="item-image" data-path="<?php
240
+ if ($image['file'] == 'pdf')
241
+ echo $this->getBaseUrl() . '/skin/adminhtml/default/default/imagerecycle/imagerecycle/images/pdf.png';
242
+ else
243
+ echo $this->getBaseUrl() . $image['file']
244
+
245
+ ?>">
246
+ <p style=" width:120px; height:40px;"> Roll over for <br/> preview </p>
247
+
248
+ </th>
249
+
250
+
251
+ <td colspan="5" style="font-size:14px"><?php echo $image['file'] ?></td>
252
+ <td colspan="2" style="font-size:15px"><span
253
+ class="filesize"><?php echo number_format($image['size_before'] / 1000, 2, '.', ''); ?></span>
254
+ </td>
255
+ <td colspan="2" class="ir-status">
256
+ <?php if ($image['extension']) : $file = realpath($image['file']); ?>
257
+ <span
258
+ class="optimizationStatus">Optimized at <?php echo round(($image['size_before'] - $image['size_after']) / $image['size_before'] * 100, 2); ?>
259
+ %</span>
260
+ <?php endif; ?>
261
+
262
+ </td>
263
+ <td colspan="2">
264
+ <?php if ($image['extension']) { ?>
265
+ <a class="button revert" href="#"
266
+ data-image-realpath="<?php echo $image['file'] ?>"><?php echo Mage::helper('imagerecycle')->__('Revert to original') ?></a>
267
+ <?php } else { ?>
268
+ <a class="button optimize" href="#"
269
+ data-image-realpath="<?php echo $image['file'] ?>"><?php echo Mage::helper('imagerecycle')->__('Optimize') ?></a>
270
+ <?php } ?>
271
+ </td>
272
+ </tr>
273
+ <?php endforeach;
274
+ } else {
275
+ echo '<tr> <th colspan="5" class="item-image"><p style = "text-align:center"> There is no data <p> </th> </tr>';
276
+ }
277
+ ?>
278
+ </tbody>
279
+ </table>
280
+
281
+ <div class="row row2" style="margin-top: 15px; padding: 0">
282
+ <select class="ir-bulk-action" name="bulk_action">
283
+ <option
284
+ value="optimize_selected"><?php echo Mage::helper('imagerecycle')->__("Optimize selected") ?></option>
285
+ <option
286
+ value="revert selected"><?php echo Mage::helper('imagerecycle')->__("Revert selected") ?></option>
287
+ </select>
288
+ <button
289
+ class="button do-bulk-action"><?php echo Mage::helper('imagerecycle')->__("Apply") ?></button>
290
+ <span class="image-recycle-label">OR</span>
291
+ <button
292
+ class="button do-optimize-all-action"><?php echo Mage::helper('imagerecycle')->__("Optimize all") ?></button>
293
+ <button class="button stop-optimize-all-action"
294
+ style="display:none"><?php echo Mage::helper('imagerecycle')->__("Stop optimize") ?></button>
295
+ <div class="pagination-wrapper">
296
+ <span style="float:left; margin-right: 8px; margin-top: 8px">
297
+ <i>Total <?php echo(!$totalImages ? "0 item" : ($this->totalImages > 1 ? "$this->totalImages items" : "1 item")) ?></i>
298
+ </span>
299
+ <?php if ($pagination = $this->pagination): ?>
300
+ <ul class="pagination">
301
+ <li class="<?php if ($this->page == $pagination->start): ?>disabled<?php endif ?>"><a
302
+ href="<?php echo $sortedUrl . "page/$pagination->start" ?>">Start</a></li>
303
+ <li class="<?php if ($this->page == $pagination->start): ?>disabled<?php endif ?>"><a
304
+ href="<?php echo $sortedUrl . "page/$pagination->prev" ?>">Prev</a></li>
305
+ <?php foreach ($pagination->range as $page): ?>
306
+ <li class="<?php if ($page == $pagination->current): ?>active<?php endif ?>"><a
307
+ href="<?php echo $sortedUrl . "page/$page" ?>"><?php echo $page ?></a></li>
308
+ <?php endforeach ?>
309
+ <li class="<?php if ($this->page == $pagination->end): ?>disabled<?php endif ?>"><a
310
+ href="<?php echo $sortedUrl . "page/$pagination->next" ?>">Next</a></li>
311
+ <li class="<?php if ($this->page == $pagination->end): ?>disabled<?php endif ?>"><a
312
+ href="<?php echo $sortedUrl . "page/$pagination->end" ?>">End</a></li>
313
+ </ul>
314
+ <?php endif ?>
315
+ </div>
316
+ </div>
317
+ <!-- Form_key is required -->
318
+ <input name="form_key" type="hidden"
319
+ value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>"/>
320
+ </form>
321
+ </div>
322
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/listing.phtml ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Mage::app()->getConfig()->reinit();
3
+ Mage::app()->getCacheInstance()->cleanType('config');
4
+ Mage::app()->reinitStores();
5
+
6
+
7
+ $optimizeall_flag = Mage::getStoreConfig('mageio_autosettig');
8
+ $optimizedCount = Mage::getStoreConfig('mageio_optimizedImageCount');
9
+ $mageio_optfailure = Mage::getStoreConfig('mageio_optfailure');
10
+ $search_name = Mage::getStoreConfig('filter_name');
11
+ $search_type = Mage::getStoreConfig('filter_type');
12
+ $search_size = Mage::getStoreConfig('filter_size');
13
+ $search_status = Mage::getStoreConfig('filter_status');
14
+
15
+ $coreConfig = Mage::getConfig();
16
+ $coreConfig->saveConfig("filter_name", Mage::helper('core')->escapeHtml(''));
17
+ $coreConfig->saveConfig("filter_type", Mage::helper('core')->escapeHtml(''));
18
+ $coreConfig->saveConfig("filter_size", Mage::helper('core')->escapeHtml(''));
19
+ $coreConfig->saveConfig("filter_status", Mage::helper('core')->escapeHtml(''));
20
+
21
+ $images = $this->loadImage($search_name, $search_type, $search_size, $search_status);
22
+ $totalImages = count($images);
23
+ // Get current url without page param
24
+
25
+ $requestParams = $this->getRequest()->getParams();
26
+ if (isset($requestParams['page'])) {
27
+ unset($requestParams['page']);
28
+ }
29
+ $order_by = isset($requestParams['order_by']) ? $requestParams['order_by'] : "";
30
+ if (isset($requestParams['dir']) && $requestParams['dir'] == 'desc') {
31
+ $dir = 'desc';
32
+ $new_dir = 'asc';
33
+ } else {
34
+ $dir = 'asc';
35
+ $new_dir = 'desc';
36
+ }
37
+ $url = Mage::helper("adminhtml")->getUrl("*/*/index");
38
+ if ($order_by != '') {
39
+ $sortedUrl = $url . "order_by/" . $order_by . "/dir/" . $dir . '/';
40
+ } else {
41
+ $sortedUrl = $url;
42
+ }
43
+
44
+ ?>
45
+ <script type="text/javascript">
46
+
47
+ var getFolders_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/getFolders") ?>?isAjax=true';
48
+ var autoaccount_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/saveAccount") ?>?isAjax=true';
49
+ var responseAjax_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/getStatus")?>?isAjax=true';
50
+ var search_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index") ?>';
51
+ var setConfig_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/setConfig") ?>?isAjax=true';
52
+ var clearstatus_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/clearstatus") ?>';
53
+ var optimize_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/optimize") ?>';
54
+ var stopoptimizeall_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/stopOptimizeAll") ?>';
55
+ var optimizeall_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/optimizeAll") ?>';
56
+ var revert_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/revert") ?>';
57
+ var reindex_init_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/reindexInit") ?>';
58
+ </script>
59
+ <div>
60
+ <div>
61
+ <a id="ir-setting" class="ir-action"
62
+ href="<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/saveconfig") ?>">Setting<i
63
+ class="icon-setting"></i></a>
64
+ <button class="do-index ir-action" href="#"
65
+ style="float:right; margin-right:5px"><?php echo Mage::helper('imagerecycle')->__('Index Images') ?></button>
66
+ </div>
67
+
68
+ <form id="irForm" method="post"
69
+ action="<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/optimize", array('page' => $this->page)) ?>">
70
+ <p class="msg-warning bulk-action-error"
71
+ style="display:none"><?php echo Mage::helper('imagerecycle')->__("Please select one Action") ?></p>
72
+ <div class="clear-left"></div>
73
+ <div class="row row1">
74
+ <div style="float: left">
75
+ <select class="ir-bulk-action" name="bulk_action">
76
+ <option
77
+ value="optimize_selected"><?php echo Mage::helper('imagerecycle')->__("Optimize selected") ?></option>
78
+ <option
79
+ value="revert selected"><?php echo Mage::helper('imagerecycle')->__("Revert selected") ?></option>
80
+ </select>
81
+ <button
82
+ class="button do-bulk-action"><?php echo Mage::helper('imagerecycle')->__("Apply") ?></button>
83
+ <span class="image-recycle-label">OR</span>
84
+ <button
85
+ class="button do-optimize-all-action"><?php echo Mage::helper('imagerecycle')->__("Optimize all") ?></button>
86
+ <button class="button stop-optimize-all-action"
87
+ style="display:none"><?php echo Mage::helper('imagerecycle')->__("Stop optimize") ?></button>
88
+ <span class="display-time"></span>
89
+ </div>
90
+
91
+ <div>
92
+ <button class="do-search ir-action" href="#"
93
+ style="float:right; margin-left:5px"><?php echo Mage::helper('imagerecycle')->__('Search') ?></button>
94
+ <button class="do-reset ir-action" href="#"
95
+ style="float:right"><?php echo Mage::helper('imagerecycle')->__('Filter Reset') ?></button>
96
+ </div>
97
+ </div>
98
+
99
+ <table class="image-recycle">
100
+ <thead>
101
+ <tr>
102
+ <th colspan="1" class="check-column"><input type="checkbox" class="ir-checkbox check-all"
103
+ name="check_all"/></th>
104
+ <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Image') ?></th>
105
+ <th colspan="5">
106
+ <?php if ($order_by == 'filename') : ?>
107
+ <a href="<?php echo $url . "order_by/filename/dir/" . $new_dir; ?>">
108
+ <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
109
+ <span
110
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
111
+ <?php else: ?>
112
+ <a href="<?php echo $url . "order_by/filename/dir/asc"; ?>">
113
+ <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
114
+ </a>
115
+ <?php endif ?>
116
+
117
+ </th>
118
+ <th colspan="2">
119
+ <?php if ($order_by == 'size') : ?>
120
+ <a href="<?php echo $url . "order_by/size/dir/" . $new_dir; ?>">
121
+ <?php echo Mage::helper('imagerecycle')->__('Size') ?>
122
+ <span
123
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
124
+ <?php else: ?>
125
+ <a href="<?php echo $url . "order_by/size/dir/asc"; ?>">
126
+ <?php echo Mage::helper('imagerecycle')->__('Size') ?>
127
+ </a>
128
+ <?php endif ?>(Kb)
129
+ </th>
130
+ <th colspan="2">
131
+ <?php if ($order_by == 'status') : ?>
132
+ <a href="<?php echo $url . "order_by/status/dir/" . $new_dir; ?>">
133
+ <?php echo Mage::helper('imagerecycle')->__('Status') ?>
134
+ <span
135
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
136
+ <?php else: ?>
137
+ <a href="<?php echo $url . "order_by/status/dir/asc"; ?>">
138
+ <?php echo Mage::helper('imagerecycle')->__('Status') ?>
139
+ </a>
140
+ <?php endif ?>
141
+ </th>
142
+ <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Action') ?></th>
143
+ </tr>
144
+ <tr class="filter">
145
+ <th colspan="1"></th>
146
+ <th colspan="2">
147
+ <select name="image_name" id="filter_type" class="no-changes">
148
+ <option value="" <?php if ($search_type == "") { ?> selected <?php } ?>>All Type</option>
149
+ <option value="jpg" <?php if ($search_type == "jpg") { ?> selected <?php } ?>>JPG</option>
150
+ <option value="png" <?php if ($search_type == "png") { ?> selected <?php } ?>>PNG</option>
151
+ <option value="gif" <?php if ($search_type == "gif") { ?> selected <?php } ?>>GIF</option>
152
+ <option value="pdf" <?php if ($search_type == "pdf") { ?> selected <?php } ?>>PDF</option>
153
+ </select>
154
+ </th>
155
+ <th colspan="3">
156
+ <div class="field-100">
157
+ <input name="name" id="filter_name"
158
+ value="<?php echo Mage::helper('imagerecycle')->__($search_name) ?>"
159
+ class="input-text no-changes" type="text"/>
160
+ </th>
161
+ <th colspan="2"></th>
162
+ <th colspan="2">
163
+ <?php //if($search_size == 0) $search_size = ''
164
+ ?>
165
+
166
+ </th colspan="2">
167
+ <th colspan="2">
168
+ <select name="image_status" id="filter_status" class="no-changes">
169
+ <option value="" <?php if ($search_status == "") { ?> selected <?php } ?>>All</option>
170
+ <option value="opt" <?php if ($search_status == "opt") { ?> selected <?php } ?>>Optimized
171
+ </option>
172
+ <option value="unopt" <?php if ($search_status == "unopt") { ?> selected <?php } ?>>not
173
+ optimized
174
+ </option>
175
+ </select>
176
+ </th>
177
+ <th colspan="2"></th>
178
+ </tr>
179
+ </thead>
180
+ <tfoot>
181
+ <tr>
182
+ <th colspan="1" class="check-column"><input type="checkbox" class="ir-checkbox check-all"
183
+ name="check_all"/></th>
184
+ <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Image') ?></th>
185
+ <th colspan="5">
186
+ <?php if ($order_by == 'filename') : ?>
187
+ <a href="<?php echo $url . "order_by/filename/dir/" . $new_dir; ?>">
188
+ <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
189
+ <span
190
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
191
+ <?php else: ?>
192
+ <a href="<?php echo $url . "order_by/filename/dir/asc"; ?>">
193
+ <?php echo Mage::helper('imagerecycle')->__('Filename') ?>
194
+ </a>
195
+ <?php endif ?>
196
+
197
+ </th>
198
+ <th colspan="2">
199
+ <?php if ($order_by == 'size') : ?>
200
+ <a href="<?php echo $url . "order_by/size/dir/" . $new_dir; ?>">
201
+ <?php echo Mage::helper('imagerecycle')->__('Size') ?>
202
+ <span
203
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
204
+ <?php else: ?>
205
+ <a href="<?php echo $url . "order_by/size/dir/asc"; ?>">
206
+ <?php echo Mage::helper('imagerecycle')->__('Size') ?>
207
+ </a>
208
+ <?php endif ?>(Kb)
209
+ </th>
210
+ <th colspan="2">
211
+ <?php if ($order_by == 'status') : ?>
212
+ <a href="<?php echo $url . "order_by/status/dir/" . $new_dir; ?>">
213
+ <?php echo Mage::helper('imagerecycle')->__('Status') ?>
214
+ <span
215
+ class="<?php if ($new_dir == 'desc'): ?>ir-arrow-up<?php else: ?>ir-arrow-down<?php endif ?>"></span></a>
216
+ <?php else: ?>
217
+ <a href="<?php echo $url . "order_by/status/dir/asc"; ?>">
218
+ <?php echo Mage::helper('imagerecycle')->__('Status') ?>
219
+ </a>
220
+ <?php endif ?>
221
+ </th>
222
+ <th colspan="2"><?php echo Mage::helper('imagerecycle')->__('Action') ?></th>
223
+ </tr>
224
+ </tfoot>
225
+ <tbody>
226
+
227
+ <?php
228
+
229
+ if ($totalImages) {
230
+ foreach ($images as $k => $image): ; ?>
231
+ <?php if ($k > 50) break; ?>
232
+ <?php $alternate = ($k % 2 == 0) ? 'even' : ''; ?>
233
+ <tr class="<?php echo $alternate ?>">
234
+ <th colspan="1" class="check-column">
235
+ <input type="checkbox" value="<?php echo $image['file'] ?>" name="images[]"
236
+ class="ir-checkbox"/>
237
+ </th>
238
+
239
+
240
+ <th colspan="2" class="item-image" data-path="<?php
241
+ if ($image['file'] == 'pdf')
242
+ echo $this->getBaseUrl() . '/skin/adminhtml/default/default/imagerecycle/imagerecycle/images/pdf.png';
243
+ else
244
+ echo $this->getBaseUrl() . $image['file']
245
+
246
+ ?>">
247
+ <p style=" width:120px; height:40px;"> Roll over for <br/> preview </p>
248
+
249
+ </th>
250
+
251
+
252
+ <td colspan="5" style="font-size:14px"><?php echo $image['file'] ?></td>
253
+ <td colspan="2" style="font-size:15px"><span
254
+ class="filesize"><?php echo number_format($image['size_before'] / 1000, 2, '.', ''); ?></span>
255
+ </td>
256
+ <td colspan="2" class="ir-status">
257
+ <?php if ($image['extension']) : $file = realpath($image['file']); ?>
258
+ <span
259
+ class="optimizationStatus">Optimized at <?php echo round(($image['size_before'] - $image['size_after']) / $image['size_before'] * 100, 2); ?>
260
+ %</span>
261
+ <?php endif; ?>
262
+
263
+ </td>
264
+ <td colspan="2">
265
+ <?php if ($image['extension']) { ?>
266
+ <a class="button revert ir-action" href="#"
267
+ data-image-realpath="<?php echo $image['file'] ?>"><?php echo Mage::helper('imagerecycle')->__('Revert to original') ?></a>
268
+ <?php } else { ?>
269
+ <a class="button optimize ir-action" href="#"
270
+ data-image-realpath="<?php echo $image['file'] ?>"><?php echo Mage::helper('imagerecycle')->__('Optimize') ?></a>
271
+ <?php } ?>
272
+ </td>
273
+ </tr>
274
+ <?php endforeach;
275
+ } else {
276
+ echo '<tr> <th colspan="5" class="item-image"><p style = "text-align:center"> There is no data <p> </th> </tr>';
277
+ }
278
+ ?>
279
+ </tbody>
280
+ </table>
281
+
282
+ <div class="row row2" style="margin-top: 15px; padding: 0">
283
+ <div style="float: left">
284
+ <select class="ir-bulk-action" name="bulk_action">
285
+ <option
286
+ value="optimize_selected"><?php echo Mage::helper('imagerecycle')->__("Optimize selected") ?></option>
287
+ <option
288
+ value="revert selected"><?php echo Mage::helper('imagerecycle')->__("Revert selected") ?></option>
289
+ </select>
290
+ <button
291
+ class="button do-bulk-action"><?php echo Mage::helper('imagerecycle')->__("Apply") ?></button>
292
+ <span class="image-recycle-label">OR</span>
293
+ <button
294
+ class="button do-optimize-all-action"><?php echo Mage::helper('imagerecycle')->__("Optimize all") ?></button>
295
+ <button class="button stop-optimize-all-action"
296
+ style="display:none"><?php echo Mage::helper('imagerecycle')->__("Stop optimize") ?></button>
297
+ </div>
298
+
299
+ <div class="pagination-wrapper">
300
+ <span style="float:left; margin-right: 8px; margin-top: 8px">
301
+ <i>Total <?php echo(!$totalImages ? "0 item" : ($this->totalImages > 1 ? "$this->totalImages items" : "1 item")) ?></i>
302
+ </span>
303
+ <?php if ($pagination = $this->pagination): ?>
304
+ <ul class="pagination">
305
+ <li class="<?php if ($this->page == $pagination->start): ?>disabled<?php endif ?>"><a
306
+ href="<?php echo $sortedUrl . "page/$pagination->start" ?>">Start</a></li>
307
+ <li class="<?php if ($this->page == $pagination->start): ?>disabled<?php endif ?>"><a
308
+ href="<?php echo $sortedUrl . "page/$pagination->prev" ?>">Prev</a></li>
309
+ <?php foreach ($pagination->range as $page): ?>
310
+ <li class="<?php if ($page == $pagination->current): ?>active<?php endif ?>"><a
311
+ href="<?php echo $sortedUrl . "page/$page" ?>"><?php echo $page ?></a></li>
312
+ <?php endforeach ?>
313
+ <li class="<?php if ($this->page == $pagination->end): ?>disabled<?php endif ?>"><a
314
+ href="<?php echo $sortedUrl . "page/$pagination->next" ?>">Next</a></li>
315
+ <li class="<?php if ($this->page == $pagination->end): ?>disabled<?php endif ?>"><a
316
+ href="<?php echo $sortedUrl . "page/$pagination->end" ?>">End</a></li>
317
+ </ul>
318
+ <?php endif ?>
319
+ </div>
320
+ </div>
321
+ <!-- Form_key is required -->
322
+ <input name="form_key" type="hidden"
323
+ value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>"/>
324
+ </form>
325
+ </div>
app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/settings.phtml ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script>page="config";</script>
2
+ <div class="imagerecycle-container">
3
+ <div class="content-header">
4
+ <h3><?php echo Mage::helper('imagerecycle')->__('Image recycle setttings') ?></h3>
5
+ </div>
6
+
7
+ <!-- ################### Quota usage information ################## -->
8
+
9
+ <h4>Optimization quota usage</h4>
10
+
11
+ <?php
12
+ include_once(Mage::getBaseDir('app') . '/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php');
13
+ $ioa = new ioaphp(Mage::getStoreConfig('mageio_api_key'), Mage::getStoreConfig('mageio_api_secret'));
14
+ $return = $ioa->getAccountInfos();
15
+ $percentQuota = 0;
16
+ $consumption_text = "";
17
+
18
+ if ($return && (floatval($return->quota_allowed) > 0)) {
19
+ $consumption_text = 'Consummated quota from' . " " . date('d F Y', $return->quota_start) . " " .
20
+ 'to' . " " . date('d F Y', $return->quota_end) . ":" .
21
+ "<b>" . $this->formateBytes(floatval($return->quota_current)) . "/ " .
22
+ $this->formateBytes(floatval($return->quota_allowed)) . "</b>";
23
+
24
+ $percentQuota = number_format(min(($return->quota_current / $return->quota_allowed), 1) * 100, 2);
25
+
26
+ echo '<p>'.$consumption_text . '(' . $percentQuota . '%)</p>';
27
+
28
+ echo '<div class="ir-progress-wrap">
29
+ <div class="ir-progress-bar" style="width: '.$percentQuota.'%"></div>
30
+ <span>'.$percentQuota.'%</span>
31
+ </div>';
32
+
33
+ } else if ($return) {
34
+ $consumption_text = 'Consummated quota from' . " " . date('d F Y', $return->quota_start) . " " .
35
+ 'to' . " " . date('d F Y', $return->quota_end) .
36
+ ": " . $this->formateBytes(floatval($return->quota_current));
37
+ echo '<p>' . $consumption_text . '</p>';
38
+
39
+ } else {
40
+ $consumption_text = 'Connection error';
41
+ echo '<p>' . $consumption_text . '</p>';
42
+
43
+ }
44
+ ?>
45
+ <a href="https://www.imagerecycle.com/prices" target="_blank" class="get-quota-btn button">
46
+ <?php echo Mage::helper("imagerecycle")->__("Get optimization quota") ?>
47
+ </a>
48
+
49
+ <div class="clear"></div>
50
+
51
+ <!-- ################### Main module settings form ################## -->
52
+
53
+ <h4>Settings</h4>
54
+
55
+ <?php
56
+ $compress_auto = !is_null($this->settings['compress_auto']) ? $this->settings['compress_auto'] : 0;
57
+ $cron_periodicity = !is_null($this->settings['cron_periodicity']) ? $this->settings['cron_periodicity'] : '5mins';
58
+ ?>
59
+
60
+ <script type="text/javascript">
61
+ var getFolders_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/getFolders") ?>?isAjax=true';
62
+ var index_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/index") ?>';
63
+ var cron_url = '<?php echo Mage::getBaseUrl() . 'imagerecycle/ImageAll/index?id=cronurl' ?>';
64
+ var is_compress_auto = '<?php echo $compress_auto; ?>';
65
+ var cron_periodicity = '<?php echo $cron_periodicity; ?>';
66
+ var reindex_init_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/reindexInit") ?>';
67
+ </script>
68
+
69
+
70
+ <div class="ir-setting">
71
+ <form action="<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/saveSetting"); ?>" method="POST">
72
+ <table class="form-table">
73
+ <tbody>
74
+ <input id="installed_time" class="formData" name="installed_time" type="hidden"
75
+ value="<?php echo Mage::getStoreConfig('mageio_installed_time'); ?>" size="50"/>
76
+ <tr>
77
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('API key : ') ?></th>
78
+ <td colspan="2">
79
+ <input id="api_key" class="formData" name="api_key" type="text"
80
+ value="<?php echo $this->escapeHtml(Mage::getStoreConfig('mageio_api_key')); ?>" size="50"/>
81
+ </td>
82
+ </tr>
83
+
84
+ <tr>
85
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('API secret : ') ?></th>
86
+ <td colspan="2">
87
+ <input id="api_secret" class="formData" name="api_secret" type="text"
88
+ value="<?php echo $this->escapeHtml(Mage::getStoreConfig('mageio_api_secret')); ?>" size="50"/>
89
+ </td>
90
+ </tr>
91
+
92
+
93
+ <tr>
94
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Include folders : ') ?></th>
95
+ <td colspan="2">
96
+ <?php
97
+
98
+ $include_folders = $this->settings['include_folders'];
99
+ $selected_folders = explode(',', $include_folders);
100
+
101
+ ?>
102
+ <input id="include_folders" class="formData" name="include_folders"
103
+ readonly='readonly' type="text" value="<?php echo $this->escapeHtml($include_folders); ?>"
104
+ size="50"/>
105
+
106
+ <a href="#" class="button" data-reveal-id="myModal"> browse </a>
107
+ </td>
108
+ </tr>
109
+
110
+
111
+ <!-- Optimize Reinitialize index yes and no -->
112
+ <tr>
113
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Reinitialize media indexation after') ?></th>
114
+ <td colspan="2">
115
+ <?php
116
+ $reindex_init = !is_null($this->settings['reindex_init']) ? $this->settings['reindex_init'] : 0;
117
+ ?>
118
+ <select id="reindex_init" name="reindex_init">
119
+ <option value="0" <?php if ($reindex_init == 0) {
120
+ echo 'selected="selected"';
121
+ } ?> >Never
122
+ </option>
123
+ <option value="5" <?php if ($reindex_init == 5) {
124
+ echo 'selected="selected"';
125
+ } ?> >5mins
126
+ </option>
127
+ <option value="10" <?php if ($reindex_init == 10) {
128
+ echo 'selected="selected"';
129
+ } ?> >10mins
130
+ </option>
131
+ <option value="20" <?php if ($reindex_init == 20) {
132
+ echo 'selected="selected"';
133
+ } ?> >20mins
134
+ </option>
135
+ <option value="30" <?php if ($reindex_init == 30) {
136
+ echo 'selected="selected"';
137
+ } ?> >30mins
138
+ </option>
139
+ <option value="60" <?php if ($reindex_init == 60) {
140
+ echo 'selected="selected"';
141
+ } ?> >1h
142
+ </option>
143
+ <option value="120" <?php if ($reindex_init == 120) {
144
+ echo 'selected="selected"';
145
+ } ?> >2h
146
+ </option>
147
+ <option value="360" <?php if ($reindex_init == 360) {
148
+ echo 'selected="selected"';
149
+ } ?> >6h
150
+ </option>
151
+ <option value="720" <?php if ($reindex_init == 720) {
152
+ echo 'selected="selected"';
153
+ } ?> >12h
154
+ </option>
155
+ <option value="1440" <?php if ($reindex_init == 1440) {
156
+ echo 'selected="selected"';
157
+ } ?> >24h
158
+ </option>
159
+ <option value="2880" <?php if ($reindex_init == 2880) {
160
+ echo 'selected="selected"';
161
+ } ?> >48h
162
+ </option>
163
+ </select>
164
+ <button class="do-index button" href="#"><?php echo Mage::helper('imagerecycle')->__('Force reindex images') ?></button>
165
+ </td>
166
+ </tr>
167
+
168
+ <!------------------------- This is the current customizing area---------------------------->
169
+ <!-- Optimize media on saving yes and no -->
170
+ <tr>
171
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Optimize media on saving') ?></th>
172
+ <td colspan="2">
173
+ <?php
174
+ $saving_auto = !is_null($this->settings['saving_auto']) ? $this->settings['saving_auto'] : 0;
175
+ ?>
176
+
177
+ <select id="saving_auto" name="saving_auto">
178
+ <option value="0" <?php if ($saving_auto == 0) {
179
+ echo 'selected="selected"';
180
+ } ?> >No
181
+ </option>
182
+ <option value="1" <?php if ($saving_auto == 1) {
183
+ echo 'selected="selected"';
184
+ } ?> >Yes
185
+ </option>
186
+ </select>
187
+ </td>
188
+ </tr>
189
+
190
+ <!---------------------- This is the auto compress yes and no ------------------------------->
191
+ <tr id='compress_auto_setting'>
192
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Automatic compression') ?></th>
193
+ <td colspan="2">
194
+
195
+ <select id="compress_auto" name="compress_auto">
196
+ <option value="0" <?php if ($compress_auto == 0) {
197
+ echo 'selected="selected"';
198
+ } ?> >No automatic compression
199
+ </option>
200
+ <option value="1" <?php if ($compress_auto == 1) {
201
+ echo 'selected="selected"';
202
+ } ?> >Magento inbuilt cron task
203
+ </option>
204
+ <option value="2" <?php if ($compress_auto == 2) {
205
+ echo 'selected="selected"';
206
+ } ?> >Custom cron task
207
+ </option>
208
+ </select>
209
+ </td>
210
+ </tr>
211
+
212
+
213
+ <!---------------------- ------------------------------->
214
+ <tr>
215
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Image resize') ?></th>
216
+ <td colspan="2">
217
+ <?php
218
+ $resize_auto = !is_null($this->settings['resize_auto']) ? $this->settings['resize_auto'] : 0;
219
+ ?>
220
+
221
+ <select id="resize_auto" name="resize_auto">
222
+ <option value="0" <?php if ($resize_auto == 0) {
223
+ echo 'selected="selected"';
224
+ } ?> >No
225
+ </option>
226
+ <option value="1" <?php if ($resize_auto == 1) {
227
+ echo 'selected="selected"';
228
+ } ?> >Yes
229
+ </option>
230
+ </select>
231
+ </td>
232
+ </tr>
233
+
234
+ <tr>
235
+ <td colspan="3">
236
+ <?php echo Mage::helper('imagerecycle')->__('<strong>Use with caution!</strong> All new images will size more than setting will be resized automatically on upload') ?>
237
+ </td>
238
+ </tr>
239
+
240
+ <tr>
241
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Image resize, max size (px)') ?></th>
242
+ <td>
243
+ <?php $resize_image = !is_null($this->settings['resize_image']) ? $this->settings['resize_image'] : 1600; ?>
244
+ <input id="resize_image" class="formData" name="resize_image" type="text"
245
+ value="<?php echo $this->escapeHtml($resize_image); ?>" size="10"/>
246
+ </td>
247
+ </tr>
248
+
249
+ <tr>
250
+ <th scope="row">
251
+ <?php echo Mage::helper('imagerecycle')->__('Min file size to optimize (Kb)') ?></th>
252
+ <td>
253
+ <?php $minSize = !is_null($this->settings['min_size']) ? $this->settings['min_size'] : 1; ?>
254
+ <input id="min_size" class="formData" name="min_size" type="text"
255
+ value="<?php echo $this->escapeHtml($minSize); ?>" size="10"/>
256
+ </td>
257
+ </th>
258
+ </tr>
259
+
260
+ <tr>
261
+ <th scope="row">
262
+ <?php echo Mage::helper('imagerecycle')->__('Max file size to optimize (Kb)') ?></th>
263
+ <td>
264
+ <?php $maxSize = !is_null($this->settings['max_size']) ? $this->settings['max_size'] : 10000; ?>
265
+ <input id="max_size" class="formData" name="max_size" type="text"
266
+ value="<?php echo $this->escapeHtml($maxSize); ?>" size="10"/>
267
+ </td>
268
+ </tr>
269
+
270
+
271
+ <tr>
272
+ <th scope="row">
273
+ <input id="compression_type" class="formData" name="compression_type" type="hidden"
274
+ value="lossy" size="50"/>
275
+ <?php echo Mage::helper('imagerecycle')->__('Compression type - PDF:') ?> </th>
276
+ <td>
277
+ <select id="compression_type_pdf" class="formData" name="compression_type_pdf">
278
+ <option
279
+ value="lossy" <?php if ($this->settings['compression_type_pdf'] == 'lossy') echo 'selected="selected"'; ?> >
280
+ Best saving
281
+ </option>
282
+ <option
283
+ value="lossless" <?php if ($this->settings['compression_type_pdf'] == 'lossless') echo 'selected="selected"'; ?>>
284
+ Original quality
285
+ </option>
286
+ <option
287
+ value="none" <?php if ($this->settings['compression_type_pdf'] == 'none') echo 'selected="selected"'; ?>>
288
+ No compression
289
+ </option>
290
+ </select>
291
+ </td>
292
+
293
+ </tr>
294
+
295
+ <tr>
296
+ <th scope="row">
297
+ <?php echo Mage::helper('imagerecycle')->__('Compression type - PNG:') ?> </th>
298
+ <td>
299
+ <select id="compression_type_png" class="formData" name="compression_type_png">
300
+ <option
301
+ value="lossy" <?php if ($this->settings['compression_type_png'] == 'lossy') echo 'selected="selected"'; ?> >
302
+ Best saving
303
+ </option>
304
+ <option
305
+ value="lossless" <?php if ($this->settings['compression_type_png'] == 'lossless') echo 'selected="selected"'; ?>>
306
+ Original quality
307
+ </option>
308
+ <option
309
+ value="none" <?php if ($this->settings['compression_type_png'] == 'none') echo 'selected="selected"'; ?>>
310
+ No compression
311
+ </option>
312
+ </select>
313
+ </td>
314
+
315
+ </tr>
316
+
317
+ <tr>
318
+ <th scope="row">
319
+ <?php echo Mage::helper('imagerecycle')->__('Compression type - JPG:') ?> </th>
320
+ <td>
321
+ <select id="compression_type_jpg" class="formData" name="compression_type_jpg">
322
+ <option
323
+ value="lossy" <?php if ($this->settings['compression_type_jpg'] == 'lossy') echo 'selected="selected"'; ?> >
324
+ Best saving
325
+ </option>
326
+ <option
327
+ value="lossless" <?php if ($this->settings['compression_type_jpg'] == 'lossless') echo 'selected="selected"'; ?>>
328
+ Original quality
329
+ </option>
330
+ <option
331
+ value="none" <?php if ($this->settings['compression_type_jpg'] == 'none') echo 'selected="selected"'; ?>>
332
+ No compression
333
+ </option>
334
+ </select>
335
+ </td>
336
+ </tr>
337
+
338
+ <tr>
339
+ <th scope="row">
340
+ <?php echo Mage::helper('imagerecycle')->__('Compression type - GIF:') ?>
341
+ </th>
342
+
343
+ <td>
344
+ <select id="compression_type_gif" class="formData" name="compression_type_gif">
345
+ <option
346
+ value="lossy" <?php if ($this->settings['compression_type_gif'] == 'lossy') echo 'selected="selected"'; ?> >
347
+ Best saving
348
+ </option>
349
+ <option
350
+ value="lossless" <?php if ($this->settings['compression_type_gif'] == 'lossless') echo 'selected="selected"'; ?>>
351
+ Original quality
352
+ </option>
353
+ <option
354
+ value="none" <?php if ($this->settings['compression_type_gif'] == 'none') echo 'selected="selected"'; ?>>
355
+ No compression
356
+ </option>
357
+ </select>
358
+ </td>
359
+ </tr>
360
+
361
+
362
+ <tr>
363
+
364
+ <td colspan="3">
365
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>"/>
366
+ <button type="submit" id="ir-setting-save" class="button"><?php echo Mage::helper('imagerecycle')->__('Save') ?></button>
367
+ <a id="ir-setting-save" class="button"
368
+ href='<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/index") ?>'>
369
+ <?php echo Mage::helper('imagerecycle')->__('Cancel') ?></a>
370
+ </td>
371
+ </tr>
372
+
373
+ </tbody>
374
+ </table>
375
+ </form>
376
+ </div>
377
+
378
+
379
+ <!-- Modal window -->
380
+ <div id="myModal" class="reveal-modal">
381
+
382
+ <script type="text/javascript">
383
+ var curFolders = <?php echo json_encode($selected_folders);?>;
384
+ </script>
385
+ <div id="wpio_foldertree"></div>
386
+ <button class="close-reveal-modal button" type="button" onclick="jSelectFolders()">OK</button>
387
+ <button class="close-reveal-modal button">Close</button>
388
+ </div>
389
+ </div>
app/etc/modules/Imagerecycle_ImageRecycle.xml CHANGED
@@ -1,9 +1,9 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Imagerecycle_Imagerecycle>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Imagerecycle_Imagerecycle>
8
- </modules>
9
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Imagerecycle_Imagerecycle>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Imagerecycle_Imagerecycle>
8
+ </modules>
9
+ </config>
js/imagerecycle/imagerecycle/bluebox.js DELETED
@@ -1,263 +0,0 @@
1
- /* Definition of BlueBox (popup) */
2
- (function($){
3
- "use strict";
4
- var BlueBox = function(id){
5
- this.id = typeof id != 'undefined' ? id : '#undefined';
6
- this.window = window;
7
- this.window['Bluebox'+id] = this;
8
- this.width = this.window.innerWidth*0.65;
9
- this.height = this.window.innerHeight*0.75;
10
- this.handler = false;//would be equal to 'iframe'
11
- this.stack = {};
12
- this.css = {};
13
- this.subject = '.bluebox-subject';
14
- this.makeCopy = false;
15
- this._clear = false;
16
- };
17
-
18
- BlueBox.prototype = {
19
- init: function(subject, options){
20
- this.subject = subject || this.subject;
21
- var options = typeof options == 'object' ? options : {};
22
-
23
- //if( this._clear ){
24
- //this.clear();
25
- //}
26
- //alert('init');
27
- this.setOptions(options);
28
- this.createBox();
29
-
30
- $(window).resize(function(){
31
- //
32
- });
33
-
34
- return this;
35
- },
36
- setOptions: function(options, callback){
37
- var $this = this;
38
- $.each(options, function(i,o){
39
- $this[i] = o;
40
- });
41
-
42
- if( typeof this.needle == 'undefined' ){
43
- this.needle = '#bluebox-btn';
44
- }
45
-
46
- this.document = this.window.document;
47
- this._clear = true;
48
-
49
- if( typeof callback == 'function' ){
50
- callback();
51
- }
52
- //console.log(this.width,this.height);
53
- return this;
54
- },
55
- set: function(key, value){
56
- this[key] = value;
57
- return this;
58
- },
59
- listen: function(Event, needle){
60
- var $this = this;
61
- var selector;
62
- if( typeof needle == 'undefined' ){
63
- selector = this.needle;
64
- }
65
-
66
- $(document).on(Event, selector, function(e){
67
- e.preventDefault();
68
- $this.open(needle, $this.subject);
69
- });
70
-
71
- return this;
72
- },
73
- specify: function(elem){
74
- if( typeof elem != 'undefined' ){
75
- var element;
76
- if( elem.jquery != 'undefined' ){
77
- element = elem;
78
- }
79
- else if( $(elem).length > 0 ){
80
- element = $(elem);
81
- }
82
-
83
- return $(element);
84
- }
85
- else{
86
- return null;
87
- }
88
-
89
- },
90
- createBox: function(){
91
- var background = this.background || '#FFF';
92
- this.background = background;
93
- var box = '';
94
- box += '<div class="bluebox-bg" style="position:fixed; left:0; top:0; right:0; bottom:0; z-index: 1; background-color: #222; opacity: 0.6;"></div>';
95
- box += '<div class="bluebox-content"><div class="content-wrapper"></div></div>';
96
- box = '<div class="bluebox" id="'+this.id.replace('#','')+'" style="position: fixed; top:0; left:0; z-index: 999999; width:100%; height: 100%; display:none">' + box + '</div>';
97
-
98
- $(this.document).find('body').append(box);
99
- this.blueBox = $(this.document).find(this.id);
100
- this.blueBoxContent = this.blueBox.find('.bluebox-content');
101
- this.contentWrapper = this.blueBoxContent.find('.content-wrapper');
102
-
103
- this.blueBox.css({
104
- 'position': 'fixed', 'top': 0, 'left': 0, 'z-index': 999999, 'width': '100%', 'height': '100%', 'display':'none'
105
- });
106
- this.blueBoxContent.css({
107
- 'width' : this.width,
108
- 'height' : this.height,
109
- 'position' : 'relative',
110
- 'left' : (this.window.innerWidth - this.width)/2,
111
- 'top' : (this.window.innerHeight - this.height)/2,
112
- 'z-index' : 2,
113
- 'overflow' : 'auto',
114
- 'padding' : '5px',
115
- 'background-color': this.background,
116
- 'border' : this.border,
117
- 'border-radius' : this.border_radius
118
- });
119
- if( this.styleBg ){
120
- this.blueBox.find('.bluebox-bg').css(this.styleBg);
121
- }
122
-
123
- return this;
124
- },
125
- addEvent: function(Event, selector, callback){
126
- if( !this.stack[Event] ){
127
- this.stack[Event] = {};
128
- }
129
- this.stack[Event][selector] = callback;
130
- return this;
131
- },
132
- triggerEvents: function(){
133
- var $this = this;
134
- $.each(this.stack, function(Event, Obj){
135
- $.each(Obj, function(selector){
136
- $this.triggerEvent(Event, selector);
137
- });
138
- });
139
-
140
- return this;
141
- },
142
- triggerEvent: function(Event, selector){
143
- if( !(this.stack[Event]) ){
144
- return this;
145
- }
146
-
147
- if( typeof selector != 'undefined' ){
148
- if( this.stack[Event][selector] ){
149
- var callback = this.stack[Event][selector];
150
- this.trigger(Event, selector, callback);
151
- }
152
- }
153
- else{
154
- var $this = this;
155
- $.each(this.stack[Event], function(selector, callback){
156
- $this.trigger(Event, selector, callback);
157
- });
158
- }
159
-
160
- return this;
161
- },
162
- trigger: function(Event, selector, callback){
163
- var $this = this;
164
- if( this.specify(selector) ){
165
- $(this.document).find(selector).unbind(Event).bind(Event, function(e){
166
- e.preventDefault();
167
- if( typeof callback == 'function' ){
168
- callback();
169
- }
170
- else if( typeof callback == 'string' ){
171
- eval(callback);
172
- }
173
- });
174
- }
175
-
176
- return this;
177
- },
178
- open: function(needle, subject){
179
- var $this = this;
180
- needle = this.specify(needle) || this.needle;
181
- subject = this.specify(subject) || $(this.subject);
182
- //this.addEvent('click', this.id+' .bluebox-bg', function(){ $this.close(); });
183
- this.triggerEvents();
184
- //this.clear();
185
- if( $this.makeCopy ){
186
- this.clear();
187
- $this.contentWrapper.append(subject.html());
188
- }
189
- else{
190
- $this.contentWrapper.append(subject);
191
- }
192
- $this.blueBox.fadeIn(200);
193
- $(this.id).find('.content-wrapper > *').show();
194
- this.bindEscape();
195
- //this.trigger('keypress', document, function(e){ $this.escape(); });
196
- return $this;
197
- },
198
- close: function(fast){
199
- if( !fast ){
200
- this.blueBox.fadeOut(100);
201
- }
202
- else{
203
- this.blueBox.hide();
204
- }
205
- },
206
- bindEscape: function(){
207
- $(document).on('keypress', function(e){
208
- var keycode = e.charCode || e.keyCode;
209
- if( keycode == 27 ){
210
- $this.close();
211
- }
212
- });
213
- },
214
- clear: function(elem){
215
- var Elem = elem;
216
- var $this = this;
217
-
218
- if( elem ){
219
- elem = this.specify(elem);
220
- if( elem.length < 1 ){
221
- elem = $(this.document).find(Elem);
222
- }
223
-
224
- elem.empty();
225
- }
226
- else{
227
- $this.contentWrapper.empty();
228
- }
229
-
230
- return this;
231
- },
232
- styleBackground: function(bg){
233
- this.styleBg = bg;
234
- return this;
235
- },
236
- issetElem: function(selector){
237
- return ( $(this.document).find(selector).length > 0 );
238
- },
239
- addNode: function(elem, parent){
240
- if( elem && parent ){
241
- $(this.document).find(parent).append(elem);
242
- }
243
-
244
- return this;
245
- }
246
- };
247
-
248
- //var Bluebox = new BlueBox();
249
- $.fn.inbox = function(id, options){
250
- if( ! window['Bluebox'+id] ){
251
- new BlueBox(id);
252
- window['Bluebox'+id].init(this, options);
253
- }
254
-
255
- return window['Bluebox'+id];
256
- };
257
-
258
- })(jQuery);
259
-
260
- /* Actions add events */
261
- jQuery(document).ready(function($){
262
- //
263
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/imagerecycle/imagerecycle/config.js ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.noConflict();
2
+ jQuery(document).ready(function($) {
3
+
4
+ //Do not load anything if not required
5
+ if(typeof(page)==='undefined' || page!=='config'){
6
+ return;
7
+ }
8
+
9
+ var sdir = '/';
10
+ jSelectFolders = function() {
11
+ curFolders.sort();
12
+ window.parent.document.getElementById('include_folders').value = curFolders;
13
+ if(curFolders.length && curFolders[0]=='')
14
+ {
15
+ curdata = window.parent.document.getElementById('include_folders').value;
16
+ window.parent.document.getElementById('include_folders').value = curdata.substr(1, curdata.length);
17
+ }
18
+
19
+ };
20
+ $('#wpio_foldertree').wpio_jaofoldertree({
21
+ script : getFolders_url,
22
+ usecheckboxes : true,
23
+ showroot : '/',
24
+ oncheck: function(elem,checked,type,file){
25
+ var dir = file;
26
+ if(file.substring(file.length-1) == sdir) {
27
+ file = file.substring(0,file.length-1);
28
+ }
29
+ if(file.substring(0,1) == sdir) {
30
+ file = file.substring(1,file.length);
31
+ }
32
+ if(checked ) {
33
+ if(file!="" && curFolders.indexOf(file)== -1) {
34
+ curFolders.push(file);
35
+ }
36
+ } else {
37
+
38
+ if(file != "" && !$(elem).next().hasClass('pchecked') ) {
39
+ temp = [];
40
+ for(i=0;i<curFolders.length;i++) {
41
+ curDir = curFolders[i];
42
+ if(curDir.indexOf(file)!==0) {
43
+ temp.push(curDir);
44
+ }
45
+ }
46
+ curFolders = temp;
47
+ } else {
48
+ var index = curFolders.indexOf(file);
49
+ if(index>-1) {
50
+ curFolders.splice(index,1);
51
+ }
52
+ }
53
+ }
54
+
55
+ }
56
+ });
57
+
58
+ jQuery('#wpio_foldertree').bind('afteropen',function(){
59
+
60
+ jQuery(jQuery('#wpio_foldertree').wpio_jaofoldertree('getchecked')).each(function() {
61
+ curDir = this.file;
62
+ if(curDir.substring(curDir.length-1) == sdir) {
63
+ curDir = curDir.substring(0,curDir.length-1);
64
+ }
65
+ if(curDir.substring(0,1) == sdir) {
66
+ curDir = curDir.substring(1,curDir.length);
67
+ }
68
+ if(curFolders.indexOf(curDir)== -1) {
69
+ curFolders.push(curDir);
70
+ }
71
+ });
72
+ spanCheckInit();
73
+ });
74
+
75
+ spanCheckInit = function() {
76
+ $("span.check").unbind('click');
77
+ $("span.check").bind('click', function() {
78
+ $(this).removeClass('pchecked');
79
+
80
+ $(this).toggleClass('checked');
81
+ if($(this).hasClass('checked')) {
82
+ $(this).prev().prop('checked', true).trigger('change');
83
+ }else {
84
+ $(this).prev().prop('checked', false).trigger('change');
85
+ }
86
+ setParentState(this);
87
+ setChildrenState(this);
88
+
89
+ });
90
+
91
+ };
92
+
93
+ setParentState = function(obj) {
94
+ var liObj = $(obj).parent().parent(); //ul.jaofoldertree
95
+ var noCheck = 0, noUncheck =0, totalEl = 0;
96
+ liObj.find('li span.check').each(function(){
97
+
98
+ if($(this).hasClass('checked')) {
99
+ noCheck++;
100
+ }else {
101
+ noUncheck++;
102
+ }
103
+ totalEl++;
104
+ });
105
+
106
+ if(totalEl==noCheck) {
107
+ liObj.parent().children('span.check').removeClass('pchecked').addClass('checked');
108
+ liObj.parent().children('input[type="checkbox"]').prop('checked',true).trigger('change');
109
+ }else if(totalEl==noUncheck) {
110
+ liObj.parent().children('span.check').removeClass('pchecked').removeClass('checked');
111
+ liObj.parent().children('input[type="checkbox"]').prop('checked',false).trigger('change');
112
+ }else {
113
+ liObj.parent().children('span.check').removeClass('checked').addClass('pchecked');
114
+ liObj.parent().children('input[type="checkbox"]').prop('checked',false).trigger('change');
115
+ }
116
+
117
+ if(liObj.parent().children('span.check').length>0) {
118
+ setParentState(liObj.parent().children('span.check'));
119
+ }
120
+ };
121
+
122
+ setChildrenState = function(obj) {
123
+ if($(obj).hasClass('checked')) {
124
+ $(obj).parent().find('li span.check').removeClass('pchecked').addClass("checked");
125
+ $(obj).parent().find('li input[type="checkbox"]').prop('checked',true).trigger('change');
126
+ }else {
127
+ $(obj).parent().find('li span.check').removeClass("checked");
128
+ $(obj).parent().find('li input[type="checkbox"]').prop('checked',false).trigger('change');
129
+ }
130
+ };
131
+
132
+ //set the dfault cron url and periodictiy
133
+
134
+ if((is_compress_auto == '1') || (is_compress_auto == '2'))
135
+ {
136
+ addremoveautocomp(is_compress_auto);
137
+ }
138
+
139
+
140
+ function addremoveautocomp(selected)
141
+ {
142
+ var period_data = ['5mins','10mins','20mins', '30min','1h','2h','6h','12h','24h','48h'];
143
+ var current_period ='';
144
+ comp_auto = $('#compress_auto').val();
145
+ if((comp_auto == '2') || (comp_auto == '1')) {
146
+ $('.remove_tag').remove();
147
+
148
+ html_data = '';
149
+ if(selected=='2'){
150
+ html_data +='<tr class = "remove_tag"><th scope="row"> Cron URL</th><td colspan="3">';
151
+ html_data += '<input id="cron_urltxt" class="formData" name="_mageio_settings[resize_image]" readonly= "readonly" type="text" value="' + cron_url+'" size="10"/></td></tr>';
152
+ }
153
+ html_data +='<tr class = "remove_tag"><th class = "remove_tag" scope="row" >Cron Period</th><td colspan="2">';
154
+ html_data +='<select id = "cron_periodicity" name="_mageio_settings[period_setting]">';
155
+
156
+ for(i = 0; i < period_data.length; i++){
157
+ html_data +='<option value="' + period_data[i];
158
+ if(cron_periodicity == period_data[i]){
159
+ html_data += '" selected>' + period_data[i] +'</option>';
160
+ }
161
+ else{
162
+ html_data += '">' + period_data[i] +'</option>';
163
+ }
164
+ }
165
+ html_data +='</select></td></tr>';
166
+ $('#compress_auto_setting').after(html_data);
167
+ }
168
+ else{
169
+ //remove the data
170
+ $('.remove_tag').remove();
171
+
172
+ }
173
+ }
174
+
175
+ $('#compress_auto').change(function(){
176
+ addremoveautocomp($(this).val());
177
+ });
178
+
179
+
180
+ $('.do-index').bind('click', function (e) {
181
+ e.preventDefault();
182
+ if(!confirm("Depending on the numbe of images you have, this can take some time to reindex all the images on your server.")){
183
+ return;
184
+ }
185
+
186
+ $.ajax({
187
+ url: reindex_init_url,
188
+ data: {form_key: window.FORM_KEY},
189
+ type: 'post',
190
+ dataType: 'json',
191
+ success: function (response) {
192
+ if (response.status === true) {
193
+ window.location.reload();
194
+ }
195
+ }
196
+ });
197
+ });
198
+
199
+ });
js/imagerecycle/imagerecycle/jaofiletree.js ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // jQuery File Tree Plugin
2
+ //
3
+ // Version 1.0
4
+ //
5
+ // Base on the work of Cory S.N. LaViska A Beautiful Site (http://abeautifulsite.net/)
6
+ // Dual-licensed under the GNU General Public License and the MIT License
7
+ // Icons from famfamfam silk icon set thanks to http://www.famfamfam.com/lab/icons/silk/
8
+ //
9
+ // Usage : $('#jao').wpio_jaofoldertree(wpio_options);
10
+ //
11
+ // Author: Damien Barrère
12
+ // Website: http://www.crac-design.com
13
+
14
+ (function( $ ) {
15
+
16
+ var wpio_options = {
17
+ 'root' : '/',
18
+ 'script' : 'connectors/jaoconnector.php',
19
+ 'showroot' : 'root',
20
+ 'onclick' : function(elem,type,file){},
21
+ 'oncheck' : function(elem,checked,type,file){},
22
+ 'usecheckboxes' : true, //can be true files dirs or false
23
+ 'expandSpeed' : 500,
24
+ 'collapseSpeed' : 500,
25
+ 'expandEasing' : null,
26
+ 'collapseEasing' : null,
27
+ 'canselect' : true
28
+ };
29
+ var wpio_methods = {
30
+ init : function(o) {
31
+ if($(this).length==0){
32
+ return;
33
+ }
34
+ $this = $(this);
35
+ $.extend(wpio_options,o);
36
+
37
+ if(wpio_options.showroot!=''){
38
+
39
+ checkboxes = '';
40
+ if(wpio_options.usecheckboxes===true || wpio_options.usecheckboxes==='dirs'){
41
+ checkboxes = '<input type="checkbox" /><span class="check" data-file="'+wpio_options.root+'" data-type="dir"></span>';
42
+ }
43
+ $this.html('<ul class="wpio_jaofoldertree"><li class="drive wpio_directory collapsed selected">'+checkboxes+'<a href="#" data-file="'+wpio_options.root+'" data-type="dir">'+wpio_options.showroot+'</a></li></ul>');
44
+ }
45
+ wpio_openfolder(wpio_options.root);
46
+ },
47
+ open : function(dir){
48
+ wpio_openfolder(dir);
49
+ },
50
+ close : function(dir){
51
+ wpio_closedir(dir);
52
+ },
53
+ getchecked : function(){
54
+ var list = [];
55
+ var ik = 0;
56
+ $this.find('input:checked + a').each(function(){
57
+ list[ik] = {
58
+ type : $(this).attr('data-type'),
59
+ file : $(this).attr('data-file')
60
+ };
61
+ ik++;
62
+ });
63
+ return list;
64
+ },
65
+ getselected : function(){
66
+ var list = [];
67
+ var ik = 0;
68
+ $this.find('li.selected > a').each(function(){
69
+ list[ik] = {
70
+ type : $(this).attr('data-type'),
71
+ file : $(this).attr('data-file')
72
+ };
73
+ ik++;
74
+ });
75
+ return list;
76
+ }
77
+ };
78
+
79
+ wpio_openfolder = function(dir) {
80
+ if($this.find('a[data-file="'+dir+'"]').parent().hasClass('expanded')){
81
+ return;
82
+ }
83
+ var ret;
84
+ ret = $.ajax({
85
+ url : wpio_options.script,
86
+ data : {dir : dir, action: 'wpio_getFolders'},
87
+ context : $this,
88
+ dataType: 'json',
89
+ beforeSend : function(){this.find('a[data-file="'+dir+'"]').parent().addClass('wait'); $(".simplemodal-container").css('height', 'auto'); }
90
+ }).done(function(datas) {
91
+ ret = '<ul class="wpio_jaofoldertree" style="display: none">';
92
+ for(ij=0; ij<datas.length; ij++){
93
+
94
+ if(datas[ij].type=='dir'){
95
+ classe = 'wpio_directory collapsed';
96
+ isdir = '/';
97
+ }else{
98
+ classe = 'file ext_'+datas[ij].ext;
99
+ isdir = '';
100
+ }
101
+ ret += '<li class="'+classe+'">';
102
+ if(wpio_options.usecheckboxes===true || (wpio_options.usecheckboxes==='dirs' && datas[ij].type=='dir') || (wpio_options.usecheckboxes==='files' && datas[ij].type=='file')){
103
+ ret += '<input type="checkbox" data-file="'+dir+datas[ij].file+isdir+'" data-type="'+datas[ij].type+'" />';
104
+ testFolder = dir+datas[ij].file;
105
+ if (testFolder.substring(0,1) == '/') {
106
+ testFolder = testFolder.substring(1,testFolder.length);
107
+ }
108
+ if(curFolders.indexOf(testFolder) > -1 ) {
109
+ ret += '<span class="check checked" data-file="'+dir+datas[ij].file+isdir+'" data-type="'+datas[ij].type+'"></span>';
110
+ }else if(datas[ij].pchecked===true) {
111
+ ret += '<span class="check pchecked" data-file="'+dir+datas[ij].file+isdir+'" data-type="'+datas[ij].type+'" ></span>';
112
+ }else {
113
+ ret += '<span class="check" data-file="'+dir+datas[ij].file+isdir+'" data-type="'+datas[ij].type+'" ></span>';
114
+ }
115
+
116
+ }
117
+ else{
118
+ ret += '<input disabled="disabled" type="checkbox" data-file="'+dir+datas[ij].file+'" data-type="'+datas[ij].type+'"/>';
119
+ }
120
+ ret += '<a href="#" data-file="'+dir+datas[ij].file+isdir+'" data-type="'+datas[ij].type+'">'+datas[ij].file+'</a>';
121
+ ret += '</li>';
122
+ }
123
+ ret += '</ul>';
124
+ this.find('a[data-file="'+dir+'"]').parent().removeClass('wait').removeClass('collapsed').addClass('expanded');
125
+ this.find('a[data-file="'+dir+'"]').after(ret);
126
+ this.find('a[data-file="'+dir+'"]').next().slideDown(wpio_options.expandSpeed,wpio_options.expandEasing);
127
+
128
+ wpio_setevents();
129
+
130
+ if(wpio_options.usecheckboxes){
131
+ this.find('a[data-file="'+dir+'"]').parent().find('li input[type="checkbox"]').attr('checked',null);
132
+ for(ij=0; ij<datas.length; ij++){
133
+ testFolder = dir+datas[ij].file;
134
+ if (testFolder.substring(0,1) == '/') {
135
+ testFolder = testFolder.substring(1,testFolder.length);
136
+ }
137
+ if( curFolders.indexOf(testFolder) > -1) {
138
+ this.find('input[data-file="'+dir+datas[ij].file+isdir+'"]').attr('checked','checked');
139
+ }
140
+ }
141
+
142
+ if( this.find('input[data-file="'+dir+'"]').is(':checked')) {
143
+ this.find('input[data-file="'+dir+'"]').parent().find('li input[type="checkbox"]').each(function(){
144
+ $(this).prop('checked',true).trigger('change');
145
+ });
146
+ this.find('input[data-file="'+dir+'"]').parent().find('li span.check').addClass("checked");
147
+ }
148
+
149
+ }
150
+
151
+
152
+ }).done(function(){
153
+ //Trigger custom event
154
+ $this.trigger('afteropen');
155
+ $this.trigger('afterupdate');
156
+ });
157
+ };
158
+
159
+ wpio_closedir = function(dir) {
160
+ $this.find('a[data-file="'+dir+'"]').next().slideUp(wpio_options.collapseSpeed,wpio_options.collapseEasing,function(){$(this).remove();});
161
+ $this.find('a[data-file="'+dir+'"]').parent().removeClass('expanded').addClass('collapsed');
162
+ wpio_setevents();
163
+
164
+ //Trigger custom event
165
+ $this.trigger('afterclose');
166
+ $this.trigger('afterupdate');
167
+
168
+ };
169
+
170
+ wpio_setevents = function(){
171
+ $this.find('li a').unbind('click');
172
+ //Bind userdefined function on click an element
173
+ $this.find('li a').bind('click', function() {
174
+ wpio_options.onclick(this, $(this).attr('data-type'),$(this).attr('data-file'));
175
+ if(wpio_options.usecheckboxes && $(this).attr('data-type')=='file'){
176
+ $this.find('li input[type="checkbox"]').attr('checked',null);
177
+ $(this).prev(':not(:disabled)').attr('checked','checked');
178
+ $(this).prev(':not(:disabled)').trigger('check');
179
+ }
180
+ if(wpio_options.canselect){
181
+ $this.find('li').removeClass('selected');
182
+ $(this).parent().addClass('selected');
183
+ }
184
+ return false;
185
+ });
186
+ //Bind checkbox check/uncheck
187
+ $this.find('li input[type="checkbox"]').bind('change', function() {
188
+ wpio_options.oncheck(this,$(this).is(':checked'), $(this).next().attr('data-type'),$(this).next().attr('data-file'));
189
+ if($(this).is(':checked')){
190
+ $this.trigger('check');
191
+ }else{
192
+ $this.trigger('uncheck');
193
+ }
194
+ });
195
+ //Bind for collapse or expand elements
196
+ $this.find('li.wpio_directory.collapsed a').bind('click', function() {wpio_methods.open($(this).attr('data-file'));return false;});
197
+ $this.find('li.wpio_directory.expanded a').bind('click', function() {wpio_methods.close($(this).attr('data-file'));return false;});
198
+ };
199
+
200
+ $.fn.wpio_jaofoldertree = function( method ) {
201
+ // Method calling logic
202
+ if ( wpio_methods[method] ) {
203
+ return wpio_methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
204
+ } else if ( typeof method === 'object' || ! method ) {
205
+ return wpio_methods.init.apply( this, arguments );
206
+ } else {
207
+ //error
208
+ }
209
+ };
210
+ })( jQuery );
js/imagerecycle/imagerecycle/jquery.min.js CHANGED
@@ -1,4 +1,2 @@
1
- /*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
2
- !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;
3
- if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")
4
- },cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on("unload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
1
+ /*! jQuery v@1.8.0 jquery.com | jquery.org/license */
2
+ (function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bX(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bV.length;while(e--){b=bV[e]+c;if(b in a)return b}return d}function bY(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function bZ(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bY(c)&&(e[f]=p._data(c,"olddisplay",cb(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b$(a,b,c){var d=bO.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function b_(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bU[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bU[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bU[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bU[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bU[e]+"Width"))||0));return f}function ca(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bP.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+b_(a,b,c||(f?"border":"content"),e)+"px"}function cb(a){if(bR[a])return bR[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bR[a]=c,c}function ch(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||cd.test(a)?d(a,e):ch(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ch(a+"["+e+"]",b[e],c,d);else d(a,b)}function cy(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cz(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cu;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cz(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cz(a,c,d,e,"*",g)),h}function cA(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cB(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cC(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cK(){try{return new a.XMLHttpRequest}catch(b){}}function cL(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cT(){return setTimeout(function(){cM=b},0),cM=p.now()}function cU(a,b){p.each(b,function(b,c){var d=(cS[b]||[]).concat(cS["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cV(a,b,c){var d,e=0,f=0,g=cR.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cM||cT(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cM||cT(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cW(k,j.opts.specialEasing);for(;e<g;e++){d=cR[e].call(j,a,k,j.opts);if(d)return d}return cU(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cW(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}}function cX(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bY(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cb(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cO.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cY(a,b,c,d,e){return new cY.prototype.init(a,b,c,d,e)}function cZ(a,b){var c,d={height:a},e=0;for(;e<4;e+=2-b)c=bU[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function c_(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=r.test(" ")?/^[\s\xA0]+|[\s\xA0]+$/g:/^\s+|\s+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.0",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":a.toString().replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||f.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete"||e.readyState!=="loading"&&e.addEventListener)setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){p.isFunction(c)&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/^(?:\{.*\}|\[.*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")===0&&(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.shift(),e=p._queueHooks(a,b),f=function(){p.dequeue(a,b)};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),delete e.stop,d.call(a,f,e)),!c.length&&e&&e.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)(d=p._data(g[h],a+"queueHooks"))&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)~f.indexOf(" "+b[g]+" ")||(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,k,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=[].slice.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click")){g=p(this),g.context=this;for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){i={},k=[],g[0]=f;for(d=0;d<q;d++)l=o[d],m=l.selector,i[m]===b&&(i[m]=g.is(m)),i[m]&&k.push(l);k.length&&u.push({elem:f,matches:k})}}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){j=u[d],c.currentTarget=j.elem;for(e=0;e<j.matches.length&&!c.isImmediatePropagationStopped();e++){l=j.matches[e];if(s||!c.namespace&&!l.namespace||c.namespace_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,h=((p.event.special[l.origType]||{}).handle||l.handler).apply(j.elem,r),h!==b&&(c.result=h,h===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{ready:{setup:p.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bd(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)Z(a,b[e],c,d)}function be(a,b,c,d,e,f){var g,h=$.setFilters[b.toLowerCase()];return h||Z.error(b),(a||!(g=e))&&bd(a||"*",d,g=[],e),g.length>0?h(g,c,f):[]}function bf(a,c,d,e,f){var g,h,i,j,k,l,m,n,p=0,q=f.length,s=L.POS,t=new RegExp("^"+s.source+"(?!"+r+")","i"),u=function(){var a=1,c=arguments.length-2;for(;a<c;a++)arguments[a]===b&&(g[a]=b)};for(;p<q;p++){s.exec(""),a=f[p],j=[],i=0,k=e;while(g=s.exec(a)){n=s.lastIndex=g.index+g[0].length;if(n>i){m=a.slice(i,g.index),i=n,l=[c],B.test(m)&&(k&&(l=k),k=e);if(h=H.test(m))m=m.slice(0,-5).replace(B,"$&*");g.length>1&&g[0].replace(t,u),k=be(m,g[1],g[2],l,k,h)}}k?(j=j.concat(k),(m=a.slice(i))&&m!==")"?B.test(m)?bd(m,j,d,e):Z(m,c,d,e?e.concat(k):k):o.apply(d,j)):Z(a,c,d,e)}return q===1?d:Z.uniqueSort(d)}function bg(a,b,c){var d,e,f,g=[],i=0,j=D.exec(a),k=!j.pop()&&!j.pop(),l=k&&a.match(C)||[""],m=$.preFilter,n=$.filter,o=!c&&b!==h;for(;(e=l[i])!=null&&k;i++){g.push(d=[]),o&&(e=" "+e);while(e){k=!1;if(j=B.exec(e))e=e.slice(j[0].length),k=d.push({part:j.pop().replace(A," "),captures:j});for(f in n)(j=L[f].exec(e))&&(!m[f]||(j=m[f](j,b,c)))&&(e=e.slice(j.shift().length),k=d.push({part:f,captures:j}));if(!k)break}}return k||Z.error(a),g}function bh(a,b,e){var f=b.dir,g=m++;return a||(a=function(a){return a===e}),b.first?function(b,c){while(b=b[f])if(b.nodeType===1)return a(b,c)&&b}:function(b,e){var h,i=g+"."+d,j=i+"."+c;while(b=b[f])if(b.nodeType===1){if((h=b[q])===j)return b.sizset;if(typeof h=="string"&&h.indexOf(i)===0){if(b.sizset)return b}else{b[q]=j;if(a(b,e))return b.sizset=!0,b;b.sizset=!1}}}}function bi(a,b){return a?function(c,d){var e=b(c,d);return e&&a(e===!0?c:e,d)}:b}function bj(a,b,c){var d,e,f=0;for(;d=a[f];f++)$.relative[d.part]?e=bh(e,$.relative[d.part],b):(d.captures.push(b,c),e=bi(e,$.filter[d.part].apply(null,d.captures)));return e}function bk(a){return function(b,c){var d,e=0;for(;d=a[e];e++)if(d(b,c))return!0;return!1}}var c,d,e,f,g,h=a.document,i=h.documentElement,j="undefined",k=!1,l=!0,m=0,n=[].slice,o=[].push,q=("sizcache"+Math.random()).replace(".",""),r="[\\x20\\t\\r\\n\\f]",s="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",t=s.replace("w","w#"),u="([*^$|!~]?=)",v="\\["+r+"*("+s+")"+r+"*(?:"+u+r+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+t+")|)|)"+r+"*\\]",w=":("+s+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",x=":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",y=r+"*([\\x20\\t\\r\\n\\f>+~])"+r+"*",z="(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|"+v+"|"+w.replace(2,7)+"|[^\\\\(),])+",A=new RegExp("^"+r+"+|((?:^|[^\\\\])(?:\\\\.)*)"+r+"+$","g"),B=new RegExp("^"+y),C=new RegExp(z+"?(?="+r+"*,|$)","g"),D=new RegExp("^(?:(?!,)(?:(?:^|,)"+r+"*"+z+")*?|"+r+"*(.*?))(\\)|$)"),E=new RegExp(z.slice(19,-6)+"\\x20\\t\\r\\n\\f>+~])+|"+y,"g"),F=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,G=/[\x20\t\r\n\f]*[+~]/,H=/:not\($/,I=/h\d/i,J=/input|select|textarea|button/i,K=/\\(?!\\)/g,L={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),NAME:new RegExp("^\\[name=['\"]?("+s+")['\"]?\\]"),TAG:new RegExp("^("+s.replace("[-","[-\\*")+")"),ATTR:new RegExp("^"+v),PSEUDO:new RegExp("^"+w),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+r+"*(even|odd|(([+-]|)(\\d*)n|)"+r+"*(?:([+-]|)"+r+"*(\\d+)|))"+r+"*\\)|)","i"),POS:new RegExp(x,"ig"),needsContext:new RegExp("^"+r+"*[>+~]|"+x,"i")},M={},N=[],O={},P=[],Q=function(a){return a.sizzleFilter=!0,a},R=function(a){return function(b){return b.nodeName.toLowerCase()==="input"&&b.type===a}},S=function(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}},T=function(a){var b=!1,c=h.createElement("div");try{b=a(c)}catch(d){}return c=null,b},U=T(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),V=T(function(a){a.id=q+0,a.innerHTML="<a name='"+q+"'></a><div name='"+q+"'></div>",i.insertBefore(a,i.firstChild);var b=h.getElementsByName&&h.getElementsByName(q).length===2+h.getElementsByName(q+0).length;return g=!h.getElementById(q),i.removeChild(a),b}),W=T(function(a){return a.appendChild(h.createComment("")),a.getElementsByTagName("*").length===0}),X=T(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==j&&a.firstChild.getAttribute("href")==="#"}),Y=T(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||a.getElementsByClassName("e").length===0?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length!==1)}),Z=function(a,b,c,d){c=c||[],b=b||h;var e,f,g,i,j=b.nodeType;if(j!==1&&j!==9)return[];if(!a||typeof a!="string")return c;g=ba(b);if(!g&&!d)if(e=F.exec(a))if(i=e[1]){if(j===9){f=b.getElementById(i);if(!f||!f.parentNode)return c;if(f.id===i)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(i))&&bb(b,f)&&f.id===i)return c.push(f),c}else{if(e[2])return o.apply(c,n.call(b.getElementsByTagName(a),0)),c;if((i=e[3])&&Y&&b.getElementsByClassName)return o.apply(c,n.call(b.getElementsByClassName(i),0)),c}return bm(a,b,c,d,g)},$=Z.selectors={cacheLength:50,match:L,order:["ID","TAG"],attrHandle:{},createPseudo:Q,find:{ID:g?function(a,b,c){if(typeof b.getElementById!==j&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==j&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==j&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:W?function(a,b){if(typeof b.getElementsByTagName!==j)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(K,""),a[3]=(a[4]||a[5]||"").replace(K,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||Z.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&Z.error(a[0]),a},PSEUDO:function(a){var b,c=a[4];return L.CHILD.test(a[0])?null:(c&&(b=D.exec(c))&&b.pop()&&(a[0]=a[0].slice(0,b[0].length-c.length-1),c=b[0].slice(0,-1)),a.splice(2,3,c||a[3]),a)}},filter:{ID:g?function(a){return a=a.replace(K,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(K,""),function(b){var c=typeof b.getAttributeNode!==j&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(K,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=M[a];return b||(b=M[a]=new RegExp("(^|"+r+")"+a+"("+r+"|$)"),N.push(a),N.length>$.cacheLength&&delete M[N.shift()]),function(a){return b.test(a.className||typeof a.getAttribute!==j&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=Z.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return Z.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=m++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[q]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[q]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e=$.pseudos[a]||$.pseudos[a.toLowerCase()];return e||Z.error("unsupported pseudo: "+a),e.sizzleFilter?e(b,c,d):e}},pseudos:{not:Q(function(a,b,c){var d=bl(a.replace(A,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!$.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:Q(function(a){return function(b){return(b.textContent||b.innerText||bc(b)).indexOf(a)>-1}}),has:Q(function(a){return function(b){return Z(a,b).length>0}}),header:function(a){return I.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:R("radio"),checkbox:R("checkbox"),file:R("file"),password:R("password"),image:R("image"),submit:S("submit"),reset:S("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return J.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},odd:function(a,b,c){var d=[],e=c?0:1,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},lt:function(a,b,c){return c?a.slice(+b):a.slice(0,+b)},gt:function(a,b,c){return c?a.slice(0,+b+1):a.slice(+b+1)},eq:function(a,b,c){var d=a.splice(+b,1);return c?a:d}}};$.setFilters.nth=$.setFilters.eq,$.filters=$.pseudos,X||($.attrHandle={href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}}),V&&($.order.push("NAME"),$.find.NAME=function(a,b){if(typeof b.getElementsByName!==j)return b.getElementsByName(a)}),Y&&($.order.splice(1,0,"CLASS"),$.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!==j&&!c)return b.getElementsByClassName(a)});try{n.call(i.childNodes,0)[0].nodeType}catch(_){n=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}var ba=Z.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},bb=Z.contains=i.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:i.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc=Z.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=bc(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=bc(b);return c};Z.attr=function(a,b){var c,d=ba(a);return d||(b=b.toLowerCase()),$.attrHandle[b]?$.attrHandle[b](a):U||d?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},Z.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},[0,0].sort(function(){return l=0}),i.compareDocumentPosition?e=function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:(e=function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],g=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return f(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)g.unshift(j),j=j.parentNode;c=e.length,d=g.length;for(var l=0;l<c&&l<d;l++)if(e[l]!==g[l])return f(e[l],g[l]);return l===c?f(a,g[l],-1):f(e[l],b,1)},f=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),Z.uniqueSort=function(a){var b,c=1;if(e){k=l,a.sort(e);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1)}return a};var bl=Z.compile=function(a,b,c){var d,e,f,g=O[a];if(g&&g.context===b)return g;e=bg(a,b,c);for(f=0;d=e[f];f++)e[f]=bj(d,b,c);return g=O[a]=bk(e),g.context=b,g.runs=g.dirruns=0,P.push(a),P.length>$.cacheLength&&delete O[P.shift()],g};Z.matches=function(a,b){return Z(a,null,null,b)},Z.matchesSelector=function(a,b){return Z(b,null,null,[a]).length>0};var bm=function(a,b,e,f,g){a=a.replace(A,"$1");var h,i,j,k,l,m,p,q,r,s=a.match(C),t=a.match(E),u=b.nodeType;if(L.POS.test(a))return bf(a,b,e,f,s);if(f)h=n.call(f,0);else if(s&&s.length===1){if(t.length>1&&u===9&&!g&&(s=L.ID.exec(t[0]))){b=$.find.ID(s[1],b,g)[0];if(!b)return e;a=a.slice(t.shift().length)}q=(s=G.exec(t[0]))&&!s.index&&b.parentNode||b,r=t.pop(),m=r.split(":not")[0];for(j=0,k=$.order.length;j<k;j++){p=$.order[j];if(s=L[p].exec(m)){h=$.find[p]((s[1]||"").replace(K,""),q,g);if(h==null)continue;m===r&&(a=a.slice(0,a.length-r.length)+m.replace(L[p],""),a||o.apply(e,n.call(h,0)));break}}}if(a){i=bl(a,b,g),d=i.dirruns++,h==null&&(h=$.find.TAG("*",G.test(a)&&b.parentNode||b));for(j=0;l=h[j];j++)c=i.runs++,i(l,b)&&e.push(l)}return e};h.querySelectorAll&&function(){var a,b=bm,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[],f=[":active"],g=i.matchesSelector||i.mozMatchesSelector||i.webkitMatchesSelector||i.oMatchesSelector||i.msMatchesSelector;T(function(a){a.innerHTML="<select><option selected></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+r+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+r+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bm=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return o.apply(f,n.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d.getAttribute("id"),k=j||q,l=G.test(a)&&d.parentNode||d;j?k=k.replace(c,"\\$&"):d.setAttribute("id",k);try{return o.apply(f,n.call(l.querySelectorAll(a.replace(C,"[id='"+k+"'] $&")),0)),f}catch(i){}finally{j||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(T(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push($.match.PSEUDO)}catch(c){}}),f=new RegExp(f.join("|")),Z.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!ba(b)&&!f.test(c)&&(!e||!e.test(c)))try{var h=g.call(b,c);if(h||a||b.document&&b.document.nodeType!==11)return h}catch(i){}return Z(c,null,null,[b]).length>0})}(),Z.attr=p.attr,p.find=Z,p.expr=Z.selectors,p.expr[":"]=p.expr.pseudos,p.unique=Z.uniqueSort,p.text=Z.getText,p.isXMLDoc=Z.isXML,p.contains=Z.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=(c[0]||c).ownerDocument||c[0]||c,typeof c.createDocumentFragment=="undefined"&&(c=e),a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=0,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(g=b===e&&bA;(h=a[s])!=null;s++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{g=g||bk(b),l=l||g.appendChild(b.createElement("div")),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(f=n.length-1;f>=0;--f)p.nodeName(n[f],"tbody")&&!n[f].childNodes.length&&n[f].parentNode.removeChild(n[f])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l=g.lastChild}h.nodeType?t.push(h):t=p.merge(t,h)}l&&(g.removeChild(l),h=l=g=null);if(!p.support.appendChecked)for(s=0;(h=t[s])!=null;s++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(s=0;(h=t[s])!=null;s++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[s+1,0].concat(r)),s+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^margin/,bO=new RegExp("^("+q+")(.*)$","i"),bP=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bQ=new RegExp("^([-+])=("+q+")","i"),bR={},bS={position:"absolute",visibility:"hidden",display:"block"},bT={letterSpacing:0,fontWeight:400,lineHeight:1},bU=["Top","Right","Bottom","Left"],bV=["Webkit","O","Moz","ms"],bW=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return bZ(this,!0)},hide:function(){return bZ(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bW.apply(this,arguments):this.each(function(){(c?a:bY(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bX(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bQ.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bX(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bT&&(f=bT[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(a,b){var c,d,e,f,g=getComputedStyle(a,null),h=a.style;return g&&(c=g[b],c===""&&!p.contains(a.ownerDocument.documentElement,a)&&(c=p.style(a,b)),bP.test(c)&&bN.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=c,c=g.width,h.width=d,h.minWidth=e,h.maxWidth=f)),c}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bP.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0||bH(a,"display")!=="none"?ca(a,b,d):p.swap(a,bS,function(){return ca(a,b,d)})},set:function(a,c,d){return b$(a,c,d?b_(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bP.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bU[d]+b]=e[d]||e[d-2]||e[0];return f}},bN.test(a)||(p.cssHooks[a+b].set=b$)});var cc=/%20/g,cd=/\[\]$/,ce=/\r?\n/g,cf=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,cg=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||cg.test(this.nodeName)||cf.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(ce,"\r\n")}}):{name:b.name,value:c.replace(ce,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ch(d,a[d],c,f);return e.join("&").replace(cc,"+")};var ci,cj,ck=/#.*$/,cl=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cm=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,cn=/^(?:GET|HEAD)$/,co=/^\/\//,cp=/\?/,cq=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cr=/([?&])_=[^&]*/,cs=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,ct=p.fn.load,cu={},cv={},cw=["*/"]+["*"];try{ci=f.href}catch(cx){ci=e.createElement("a"),ci.href="",ci=ci.href}cj=cs.exec(ci.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&ct)return ct.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cq,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cA(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cA(a,b),a},ajaxSettings:{url:ci,isLocal:cm.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cw},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cy(cu),ajaxTransport:cy(cv),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cB(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cC(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cl.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(ck,"").replace(co,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=cs.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==cj[1]&&i[2]==cj[2]&&(i[3]||(i[1]==="http:"?80:443))==(cj[3]||(cj[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cz(cu,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!cn.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cp.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cr,"$1_="+z);l.url=A+(A===l.url?(cp.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cw+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cz(cv,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cD=[],cE=/\?/,cF=/(=)\?(?=&|$)|\?\?/,cG=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cD.pop()||p.expando+"_"+cG++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cF.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cF.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cF,"$1"+f):m?c.data=i.replace(cF,"$1"+f):k&&(c.url+=(cE.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cD.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cH,cI=a.ActiveXObject?function(){for(var a in cH)cH[a](0,1)}:!1,cJ=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cK()||cL()}:cK,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cI&&delete cH[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cJ,cI&&(cH||(cH={},p(a).unload(cI)),cH[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cM,cN,cO=/^(?:toggle|show|hide)$/,cP=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cQ=/queueHooks$/,cR=[cX],cS={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cP.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cV,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cS[c]=cS[c]||[],cS[c].unshift(b)},prefilter:function(a,b){b?cR.unshift(a):cR.push(a)}}),p.Tween=cY,cY.prototype={constructor:cY,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cY.propHooks[this.prop];return a&&a.get?a.get(this):cY.propHooks._default.get(this)},run:function(a){var b,c=cY.propHooks[this.prop];return this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration),this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cY.propHooks._default.set(this),this}},cY.prototype.init.prototype=cY.prototype,cY.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cY.propHooks.scrollTop=cY.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(cZ(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bY).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cV(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cQ.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:cZ("show"),slideUp:cZ("hide"),slideToggle:cZ("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cY.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cN&&(cN=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cN),cN=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c$=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j,k,l,m=this[0],n=m&&m.ownerDocument;if(!n)return;return(e=n.body)===m?p.offset.bodyOffset(m):(d=n.documentElement,p.contains(d,m)?(c=m.getBoundingClientRect(),f=c_(n),g=d.clientTop||e.clientTop||0,h=d.clientLeft||e.clientLeft||0,i=f.pageYOffset||d.scrollTop,j=f.pageXOffset||d.scrollLeft,k=c.top+i-g,l=c.left+j-h,{top:k,left:l}):{top:0,left:0})},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c$.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c$.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=c_(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window);
 
 
js/imagerecycle/imagerecycle/jquery.reveal.js ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery Reveal Plugin 1.0
3
+ * www.ZURB.com
4
+ * Copyright 2010, ZURB
5
+ * Free to use under the MIT license.
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ */
8
+
9
+
10
+ (function($) {
11
+
12
+ /*---------------------------
13
+ Defaults for Reveal
14
+ ----------------------------*/
15
+
16
+ /*---------------------------
17
+ Listener for data-reveal-id attributes
18
+ ----------------------------*/
19
+
20
+ $('a[data-reveal-id]').live('click', function(e) {
21
+ e.preventDefault();
22
+ var modalLocation = $(this).attr('data-reveal-id');
23
+ $('#'+modalLocation).reveal($(this).data());
24
+ });
25
+
26
+ /*---------------------------
27
+ Extend and Execute
28
+ ----------------------------*/
29
+
30
+ $.fn.reveal = function(options) {
31
+
32
+
33
+ var defaults = {
34
+ animation: 'fadeAndPop', //fade, fadeAndPop, none
35
+ animationspeed: 300, //how fast animtions are
36
+ closeonbackgroundclick: true, //if you click background will modal close?
37
+ dismissmodalclass: 'close-reveal-modal' //the class of a button or element that will close an open modal
38
+ };
39
+
40
+ //Extend dem' options
41
+ var options = $.extend({}, defaults, options);
42
+
43
+ return this.each(function() {
44
+
45
+ /*---------------------------
46
+ Global Variables
47
+ ----------------------------*/
48
+ var modal = $(this),
49
+ topMeasure = parseInt(modal.css('top')),
50
+ topOffset = modal.height() + topMeasure,
51
+ locked = false,
52
+ modalBG = $('.reveal-modal-bg');
53
+
54
+ /*---------------------------
55
+ Create Modal BG
56
+ ----------------------------*/
57
+ if(modalBG.length == 0) {
58
+ modalBG = $('<div class="reveal-modal-bg" />').insertAfter(modal);
59
+ }
60
+
61
+ /*---------------------------
62
+ Open & Close Animations
63
+ ----------------------------*/
64
+ //Entrance Animations
65
+ modal.bind('reveal:open', function () {
66
+ modalBG.unbind('click.modalEvent');
67
+ $('.' + options.dismissmodalclass).unbind('click.modalEvent');
68
+ if(!locked) {
69
+ lockModal();
70
+ if(options.animation == "fadeAndPop") {
71
+ modal.css({'top': $(document).scrollTop()-topOffset, 'opacity' : 0, 'visibility' : 'visible'});
72
+ modalBG.fadeIn(options.animationspeed/2);
73
+ modal.delay(options.animationspeed/2).animate({
74
+ "top": $(document).scrollTop()+topMeasure + 'px',
75
+ "opacity" : 1
76
+ }, options.animationspeed,unlockModal());
77
+ }
78
+ if(options.animation == "fade") {
79
+ modal.css({'opacity' : 0, 'visibility' : 'visible', 'top': $(document).scrollTop()+topMeasure});
80
+ modalBG.fadeIn(options.animationspeed/2);
81
+ modal.delay(options.animationspeed/2).animate({
82
+ "opacity" : 1
83
+ }, options.animationspeed,unlockModal());
84
+ }
85
+ if(options.animation == "none") {
86
+ modal.css({'visibility' : 'visible', 'top':$(document).scrollTop()+topMeasure});
87
+ modalBG.css({"display":"block"});
88
+ unlockModal()
89
+ }
90
+ }
91
+ modal.unbind('reveal:open');
92
+ });
93
+
94
+ //Closing Animation
95
+ modal.bind('reveal:close', function () {
96
+ if(!locked) {
97
+ lockModal();
98
+ if(options.animation == "fadeAndPop") {
99
+ modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
100
+ modal.animate({
101
+ "top": $(document).scrollTop()-topOffset + 'px',
102
+ "opacity" : 0
103
+ }, options.animationspeed/2, function() {
104
+ modal.css({'top':topMeasure, 'opacity' : 1, 'visibility' : 'hidden'});
105
+ unlockModal();
106
+ });
107
+ }
108
+ if(options.animation == "fade") {
109
+ modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
110
+ modal.animate({
111
+ "opacity" : 0
112
+ }, options.animationspeed, function() {
113
+ modal.css({'opacity' : 1, 'visibility' : 'hidden', 'top' : topMeasure});
114
+ unlockModal();
115
+ });
116
+ }
117
+ if(options.animation == "none") {
118
+ modal.css({'visibility' : 'hidden', 'top' : topMeasure});
119
+ modalBG.css({'display' : 'none'});
120
+ }
121
+ }
122
+ modal.unbind('reveal:close');
123
+ });
124
+
125
+ /*---------------------------
126
+ Open and add Closing Listeners
127
+ ----------------------------*/
128
+ //Open Modal Immediately
129
+ modal.trigger('reveal:open');
130
+
131
+ //Close Modal Listeners
132
+ var closeButton = $('.' + options.dismissmodalclass).bind('click.modalEvent', function () {
133
+ modal.trigger('reveal:close')
134
+ });
135
+
136
+ if(options.closeonbackgroundclick) {
137
+ modalBG.css({"cursor":"pointer"});
138
+ modalBG.bind('click.modalEvent', function () {
139
+ modal.trigger('reveal:close')
140
+ });
141
+ }
142
+ $('body').keyup(function(e) {
143
+ if(e.which===27){ modal.trigger('reveal:close'); } // 27 is the keycode for the Escape key
144
+ });
145
+
146
+
147
+ /*---------------------------
148
+ Animations Locks
149
+ ----------------------------*/
150
+ function unlockModal() {
151
+ locked = false;
152
+ }
153
+ function lockModal() {
154
+ locked = true;
155
+ }
156
+
157
+ });//each call
158
+ }//orbit plugin call
159
+ })(jQuery);;
160
+
js/imagerecycle/imagerecycle/script.js CHANGED
@@ -1,217 +1,423 @@
1
- /* Image Recycle */
2
- var $j = jQuery.noConflict();
3
- $j(document).ready(function() {
4
-
5
- initButtons = function() {
6
-
7
- //Optimize image via ajax
8
- $j('.optimize.ir-action').unbind('click').bind('click', function(e) {
9
-
10
- e.preventDefault();
11
- var $this = $j(e.target);
12
- var image = $this.data('image-realpath');
13
- if (!image || $this.hasClass('disabled')) {
14
- return false;
15
- }
16
-
17
- $j.ajax({
18
- url: optimize_url,
19
- data: {image: image, form_key: window.FORM_KEY},
20
- type: 'post',
21
- dataType: 'json',
22
- beforeSend: function() {
23
- $this.addClass('disabled');
24
- var $status = $this.closest('tr').find('.ir-status');
25
- $status.html($j("#ir-setting-loader").html());
26
- },
27
- success: function(response) {
28
-
29
- var $status = $this.closest('tr').find('.ir-status');
30
- if (response.status === true) {
31
- $status.addClass('msg-success');
32
- $status.empty().text(response.datas.msg);
33
- if (response.datas.newSize) {
34
- $this.closest('tr').find('.filesize').empty().text(response.datas.newSize);
35
- }
36
- $this.removeClass('disabled optimize').addClass('revert').text('Revert to original');
37
- initButtons();
38
- }
39
- else {
40
- $status.addClass('msg-error');
41
- $status.empty().text(response.datas.msg);
42
- setTimeout(function() {
43
- $this.removeClass('disabled');
44
- $status.empty();
45
- }, 5000);
46
- }
47
-
48
-
49
- }
50
- });
51
- });
52
-
53
- $j('.revert.ir-action').unbind('click').bind('click', function(e) {
54
- e.preventDefault();
55
-
56
- var $this = $j(e.target);
57
- var image = $this.data('image-realpath');
58
- if (!image || $this.hasClass('disabled')) {
59
- return false;
60
- }
61
-
62
- $j.ajax({
63
- url: revert_url,
64
- data: {image: image, form_key: window.FORM_KEY},
65
- //async : false,
66
- type: 'post',
67
- dataType: 'json',
68
- beforeSend: function() {
69
- $this.addClass('disabled');
70
- var $status = $this.closest('tr').find('.ir-status');
71
- $status.html($j("#ir-setting-loader").html());
72
- },
73
- success: function(response) {
74
-
75
- var $status = $this.closest('tr').find('.ir-status');
76
- if (response.status === true) {
77
- $status.addClass('msg-success');
78
- $status.empty().text(response.datas.msg);
79
- if (response.datas.newSize) {
80
- $this.closest('tr').find('.filesize').empty().text(response.datas.newSize);
81
- }
82
- $this.removeClass('disabled revert').addClass('optimize').text('Optimize');
83
- initButtons();
84
- }
85
- else {
86
- $status.addClass('msg-error');
87
- $status.empty().text(response.datas.msg);
88
- setTimeout(function() {
89
- $this.removeClass('disabled');
90
- $status.empty();
91
- }, 5000);
92
- }
93
-
94
- }
95
- });
96
- })
97
- };
98
- initButtons();
99
-
100
- //Change the setting
101
- $j('#ir-setting-save').bind('click', function(e) {
102
- e.preventDefault();
103
- var data = {
104
- form_key: window.FORM_KEY,
105
- api_key: $j('#api_key').val(),
106
- api_secret: $j('#api_secret').val(),
107
- min_size: $j('#min_size').val(),
108
- exclude_folders : $j('#exclude_folders').val(),
109
- resize_auto : $j('#resize_auto').val(),
110
- resize_image : $j('#resize_image').val(),
111
- min_size : $j('#min_size').val(),
112
- max_size : $j('#max_size').val(),
113
- compression_type_pdf : $j('#compression_type_pdf').val(),
114
- compression_type_png : $j('#compression_type_png').val(),
115
- compression_type_jpg : $j('#compression_type_jpg').val(),
116
- compression_type_gif : $j('#compression_type_gif').val(),
117
- };
118
-
119
- $j.ajax({
120
- url: saveConfig_url,
121
- data: data,
122
- type: 'post',
123
- dataType: 'json',
124
- beforeSend: function() {
125
- $j('#ir-setting-loader').show();
126
- },
127
- success: function(response) {
128
- $j('#ir-setting-loader').hide();
129
- if (response.success === true) {
130
- $j('#ir-setting-msg').empty().text(response.msg).fadeIn(200).delay(2000)
131
- .fadeOut(200, function() {
132
- $j('.ir-setting').fadeOut(200);
133
- });
134
- }
135
- }
136
- })
137
- });
138
-
139
- //Checked or not all checkbox
140
- $j('.ir-checkbox.check-all').bind('click', function(e) {
141
- var $status = $j(this).is(':checked');
142
- $j('.ir-checkbox').each(function(i, ck) {
143
- $j(ck).prop('checked', $status);
144
- });
145
- });
146
-
147
- // Pagination include form data
148
- $j('ul.pagination > li > a').bind('click', function(e) {
149
- e.preventDefault();
150
- var href = $j(this).attr('href');
151
- window.location.href = href + '?' + $j('#irForm').serialize();
152
- });
153
-
154
- // Setting action
155
- $j('#ir-setting').bind('click', function(e) {
156
- $j('.ir-setting').fadeToggle();
157
- });
158
-
159
- // Do bulk action
160
- $j('.do-bulk-action').bind('click', function(e) {
161
- e.preventDefault();
162
- if ($j('.ir-bulk-action').val() == '-1') {
163
-
164
- var ir_bulk_action = $j('.ir-bulk-action');
165
- var border_color = '#DDD';
166
- ir_bulk_action.css('border-color', '#FF3300');
167
- setTimeout(function() {
168
- ir_bulk_action.css('border-color', border_color);
169
- }, 300);
170
- }
171
- else if ($j('.ir-bulk-action').val() !== 'optimize_all') {
172
-
173
- if ($j('.ir-checkbox:checked').length < 1) {
174
- alert("No image selected");
175
- } else {
176
-
177
- $j('.ir-checkbox:checked').each(function(i) {
178
- $j(this).parents('tr').find('.ir-action.optimize').click();
179
- });
180
- }
181
-
182
- } else {
183
-
184
- $j('#anchor-content').prepend('<div id="mageio_wait"><div>Please wait during optimization<br/><span></span></div></div>');
185
- $j('#mageio_wait').click(function() {
186
- window.location.reload();
187
- });
188
- optimizeAll();
189
- }
190
- });
191
-
192
- optimizeAll = function() {
193
- $j.ajax({
194
- url: optimizeall_url,
195
- data: {form_key: window.FORM_KEY},
196
- type: 'post',
197
- dataType: 'json',
198
- success: function(response) {
199
- if (typeof (response.status) !== 'undefined' && response.status === true) {
200
- if (response.datas.continue === true) {
201
- $j('#mageio_wait span').html(response.datas.totalOptimizedImages + ' optimized images / ' + response.datas.totalImages + ' images');
202
- optimizeAll();
203
- } else {
204
- window.location.reload();
205
- }
206
- }
207
- }
208
- })
209
- }
210
-
211
-
212
- // Prevent disabled elem to default action
213
- $j('.disabled').bind('click', function(e) {
214
- e.preventDefault();
215
- });
216
-
217
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Image Recycle */
2
+ jQuery.noConflict();
3
+ jQuery(document).ready(function ($) {
4
+
5
+ //Add event listener for simplified connect behaviour
6
+ if(typeof(page)!=='undefined' && page==='connect'){
7
+ window.addEventListener("message",
8
+ function (e) {
9
+
10
+ if (e.origin !== "https://www.imagerecycle.com") {
11
+ return;
12
+ }
13
+ var accountData = JSON.parse(e.data);
14
+
15
+ jQuery.ajax({
16
+ url: autoaccount_url,
17
+ data: {form_key: window.FORM_KEY, apikey: accountData.key, secret: accountData.secret},
18
+ type: 'post',
19
+ dataType: 'json',
20
+ success: function (response) {
21
+ if (response.status == true) {
22
+ tb_remove();
23
+ window.location.reload();
24
+
25
+ }
26
+ else {
27
+ alert("Error, try again");
28
+ }
29
+ }
30
+ });
31
+ },
32
+ false);
33
+ }
34
+
35
+ //Do not load anything if not required
36
+ if(typeof(page)==='undefined' || page!=='main'){
37
+ return;
38
+ }
39
+
40
+ var myStatus;
41
+
42
+ if (optimizeall_flag == "On") {
43
+
44
+ allcontroldisable();
45
+ //disableButton();
46
+ // button disable:: do-bulk-action
47
+ myStatus = setInterval(setStatus, 10000);
48
+ }
49
+ switch ($('.error-no').val()) {
50
+ case '0':
51
+ $(".error").css("color", "red").html("Upload Success!");
52
+ break;
53
+ case '1':
54
+ $(".error").css("color", "red").html("File not found!");
55
+ break;
56
+ case '2':
57
+ $(".error").css("color", "red").html("Not yet set API and Seceret Key!");
58
+ break;
59
+ case '3':
60
+ $(".error").css("color", "red").html("API and Seceret Key is not valid or Network error!");
61
+ break;
62
+ case '4':
63
+ $(".error").css("color", "red").html("Can not get the file content!");
64
+ break;
65
+ case '5':
66
+ $(".error").css("color", "red").html("Fail to file write error!");
67
+ break;
68
+ case '6':
69
+ $(".error").css("color", "red").html("Extension error!");
70
+ break;
71
+ }
72
+ setTimeout(function () {
73
+ $.ajax({
74
+ url: clearstatus_url,
75
+ data: {form_key: window.FORM_KEY},
76
+ type: 'post',
77
+ dataType: 'json',
78
+ success: function (response) {
79
+ if (response.status === true) {
80
+ $(".error").css("color", "red").html("");
81
+ }
82
+ }
83
+ })
84
+
85
+ }, 5000
86
+ );
87
+ initButtons = function () {
88
+ $('.optimize').unbind('click').bind('click', function (e) {
89
+
90
+ e.preventDefault();
91
+ var $this = $(e.target);
92
+ var image = $this.data('image-realpath');
93
+
94
+ if (!image || $this.hasClass('disabled')) {
95
+ return false;
96
+ }
97
+ $.ajax({
98
+ url: optimize_url,
99
+ data: {image: image, form_key: window.FORM_KEY},
100
+ type: 'post',
101
+ dataType: 'json',
102
+ beforeSend: function () {
103
+ $this.addClass('disabled');
104
+ disableButton();
105
+ var $status = $this.closest('tr').find('.ir-status');
106
+ $status.html($("#ir-setting-loader").html());
107
+ },
108
+ success: function (response) {
109
+
110
+ var $status = $this.closest('tr').find('.ir-status');
111
+ if (response.status === true) {
112
+ $status.addClass('msg-success');
113
+ $status.empty().text(response.datas.msg);
114
+ if (response.datas.newSize) {
115
+ $this.closest('tr').find('.filesize').empty().text(response.datas.newSize);
116
+ }
117
+ enableButton();
118
+ initButtons();
119
+ initOptimizeButton();
120
+ }
121
+ else {
122
+ if (response.datas.error) {
123
+ window.location.reload();
124
+ }
125
+
126
+ $status.addClass('msg-error');
127
+ $status.empty().text(response.datas.msg);
128
+ enableButton();
129
+ setTimeout(function () {
130
+ $this.removeClass('disabled');
131
+ $status.empty();
132
+ }, 5000);
133
+ }
134
+
135
+
136
+ }
137
+ });
138
+ });
139
+
140
+ $('.revert').unbind('click').bind('click', function (e) {
141
+ e.preventDefault();
142
+ var $this = $(e.target);
143
+ var image = $this.data('image-realpath');
144
+ if (!image || $this.hasClass('disabled')) {
145
+ return false;
146
+ }
147
+ $.ajax({
148
+ url: revert_url,
149
+ data: {image: image, form_key: window.FORM_KEY},
150
+ //async : false,
151
+ type: 'post',
152
+ dataType: 'json',
153
+ beforeSend: function () {
154
+ $this.addClass('disabled');
155
+ //disableButton();
156
+ var $status = $this.closest('tr').find('.ir-status');
157
+ $status.html($("#ir-setting-loader").html());
158
+ $("button").addClass('disabled');
159
+ },
160
+ success: function (response) {
161
+
162
+ var $status = $this.closest('tr').find('.ir-status');
163
+ if (response.status === true) {
164
+ $status.addClass('msg-success');
165
+ $status.empty().text(response.datas.msg);
166
+ if (response.datas.newSize) {
167
+ $this.closest('tr').find('.filesize').empty().text(response.datas.newSize);
168
+ }
169
+ $this.removeClass('disabled revert').addClass('optimize').text('Optimize');
170
+ initButtons();
171
+ initOptimizeButton();
172
+ }
173
+ else {
174
+ $status.addClass('msg-error');
175
+ $status.empty().text(response.datas.msg);
176
+ setTimeout(function () {
177
+ $this.removeClass('disabled');
178
+ $('button').removeClass('disabled');
179
+ $status.empty();
180
+ }, 5000);
181
+ }
182
+
183
+ }
184
+ });
185
+ })
186
+ };
187
+
188
+ initButtons();
189
+ $('.ir-checkbox.check-all').bind('click', function (e) {
190
+ var $status = $(this).is(':checked');
191
+ $('.ir-checkbox').each(function (i, ck) {
192
+ $(ck).prop('checked', $status);
193
+ });
194
+ });
195
+
196
+ $('ul.pagination > li > a').bind('click', function (e) {
197
+ e.preventDefault();
198
+ var href = $(this).attr('href');
199
+ window.location.href = href + '?' + $('#irForm').serialize();
200
+ });
201
+
202
+ var flag = 0;
203
+ $('.do-bulk-action').bind('click', function (e) {
204
+ e.preventDefault();
205
+ setTimeout(function () {
206
+ if (flag) return;
207
+ if ($('.ir-bulk-action').val() == 'optimize_selected') {
208
+
209
+ if ($('.ir-checkbox:checked').length < 1) {
210
+ alert("No image selected for optimize");
211
+ } else {
212
+
213
+ $('.ir-checkbox:checked').each(function (i) {
214
+ $(this).parents('tr').find('.optimize').click();
215
+ });
216
+ }
217
+ } else {
218
+ if ($('.ir-checkbox:checked').length < 1) {
219
+ alert("No image selected for revert");
220
+ } else {
221
+ $('.ir-checkbox:checked').each(function (i) {
222
+ $(this).parents('tr').find('.revert').click();
223
+ });
224
+ }
225
+ }
226
+ }, 250);
227
+ });
228
+
229
+ //Auto reload page with selected filters
230
+ $('#filter_type, #filter_status').change(function () {
231
+ $('.do-search').click();
232
+ });
233
+
234
+ $('.do-search').bind('click', function (e) {
235
+ e.preventDefault();
236
+ var data = {
237
+ form_key: window.FORM_KEY,
238
+ filter_type: $('#filter_type').val(),
239
+ filter_name: $('#filter_name').val(),
240
+ filter_status: $('#filter_status').val(),
241
+ };
242
+ $.ajax({
243
+ url: setConfig_url,
244
+ data: data,
245
+ type: 'post',
246
+ dataType: 'json',
247
+ success: function (response) {
248
+ if (response.success === true) {
249
+ var href = $(this).attr('href');
250
+ window.location.href = href + '?' + $('#irForm').serialize();
251
+ }
252
+ }
253
+ })
254
+ });
255
+
256
+ initOptimizeButton = function () {
257
+ $('button').removeClass('disabled');
258
+ $('#progressbar').css('display', 'none');
259
+ $('.do-optimize-all-action').unbind('click').click(function (e) {
260
+ e.preventDefault();
261
+ $('.optimizeall_flag').val('On');
262
+ optimizeAll();
263
+ });
264
+
265
+ $('.stop-optimize-all-action').unbind('click').click(function (e) {
266
+ e.preventDefault();
267
+ $('.optimizeall_flag').val('Off');
268
+ stopOptimizeAll();
269
+ });
270
+
271
+ };
272
+ initOptimizeButton();
273
+
274
+ optimizeAll = function () {
275
+ var data = {
276
+ form_key: window.FORM_KEY,
277
+ filter_type: $('#filter_type').val(),
278
+ filter_name: $('#filter_name').val(),
279
+ filter_status: $('#filter_status').val()
280
+ };
281
+ $.ajax({
282
+ url: optimizeall_url,
283
+ data: data,
284
+ type: 'post',
285
+ dataType: 'json',
286
+ beforeSend: function () {
287
+ $('td > a').addClass('disabled');
288
+
289
+ },
290
+ success: function (response) {
291
+ if (response.status == true) {
292
+ //disableButton();
293
+ $(".display-time").css("display", "inline-block");
294
+ $('.do-optimize-all-action').css('display', 'none');
295
+ $('.stop-optimize-all-action').css('display', 'inline-block');
296
+ myStatus = setInterval(setStatus, 30000);
297
+ }
298
+ }
299
+ })
300
+ };
301
+
302
+ $("#filter_name").keyup(function (e) {
303
+ if (e.keyCode == 13) {
304
+ flag = 1;
305
+ $('.do-search').trigger('click');
306
+ }
307
+ return false;
308
+ });
309
+
310
+
311
+ $('.item-image').hover(
312
+ function () {
313
+ if ($(this).data('path')) {
314
+ $(this).empty();
315
+ var htmls = ' <img class="image-small" src="' + $(this).data('path') + '" /> ';
316
+ $(this).append(htmls);
317
+
318
+ }
319
+ }, function () {
320
+ }
321
+ );
322
+ stopOptimizeAll = function () {
323
+ $.ajax({
324
+ url: stopoptimizeall_url,
325
+ data: {form_key: window.FORM_KEY},
326
+ type: 'post',
327
+ dataType: 'json',
328
+ beforeSend: function () {
329
+ $('a').removeClass('disabled');
330
+ // disableButton();
331
+ },
332
+ success: function (response) {
333
+ if (response.status == false) {
334
+ $('.stop-optimize-all-action').css('display', 'none');
335
+ $('.do-optimize-all-action').css('display', 'inline-block');
336
+
337
+ }
338
+ }
339
+ })
340
+ };
341
+
342
+ function setStatus() {
343
+
344
+ $.ajax({
345
+ url: responseAjax_url,
346
+ data: {form_key: window.FORM_KEY},
347
+ type: 'post',
348
+ dataType: 'json',
349
+ success: function (response) {
350
+ if (response.status == true) {
351
+
352
+ if (response.datas.op_status == "On") {
353
+ //Do not show time
354
+ return;
355
+ if(window.startTime == undefined){
356
+ window.startTime = Date.now();
357
+ window.startCount = response.datas.optimizedCount;
358
+ }
359
+ displayTimedetail(window.startCount - response.datas.optimizedCount, window.startTime - Date.now());
360
+ } else {
361
+ $('.do-optimize-all-action').css('display', 'inline-block');
362
+ $('.stop-optimize-all-action').css('display', 'none');
363
+ clearInterval(myStatus);
364
+ window.location.reload();
365
+ }
366
+
367
+ }
368
+ }
369
+ })
370
+ }
371
+
372
+
373
+ displayTimedetail = function (param1, param2) {
374
+ var reTime = param1 * param2 / 1000;
375
+ var remainTimeStr = toHHMMSS(Math.floor(reTime));
376
+
377
+ if (reTime === 0) {
378
+ $(".display-time").css("color", "black").html("Please wait while calculating remaining time");
379
+ } $(".display-time").css("color", "blue").html("remaining time " + remainTimeStr);
380
+ };
381
+
382
+ toHHMMSS = function (sec_num) {
383
+ var hours = Math.floor(sec_num / 3600);
384
+ var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
385
+ var seconds = sec_num - (hours * 3600) - (minutes * 60);
386
+ if (minutes < 10) {
387
+ minutes = "0" + minutes;
388
+ }
389
+ if (seconds < 10) {
390
+ seconds = "0" + seconds;
391
+ }
392
+ var time = '';
393
+ if (hours == 0) {
394
+ time = minutes + 'm ' + seconds + 's';
395
+ } else {
396
+ if (hours < 10) {
397
+ hours = "0" + hours;
398
+ }
399
+ time = hours + 'h ' + minutes + 'm ' + seconds + 's';
400
+ }
401
+ return time;
402
+ };
403
+
404
+ $('.disabled').bind('click', function (e) {
405
+ e.preventDefault();
406
+ });
407
+
408
+ function allcontroldisable() {
409
+ $(".display-time").css("display", "inline-block");
410
+ $('.do-optimize-all-action').css('display', 'none');
411
+ $('.stop-optimize-all-action').css('display', 'inline-block');
412
+ $('.do-bulk-action').addClass('disabled');
413
+ $('td > a').addClass('disabled');
414
+ }
415
+
416
+ function disableButton() {
417
+ $(".imagerecycle-container .button").attr('disabled', 'disabled');
418
+ }
419
+
420
+ function enableButton() {
421
+ $(".imagerecycle-container .button").attr('disabled', null);
422
+ }
423
+ });
js/imagerecycle/imagerecycle/thickbox.js ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Thickbox 3.1 - One Box To Rule Them All.
3
+ * By Cody Lindley (http://www.codylindley.com)
4
+ * Copyright (c) 2007 cody lindley
5
+ * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
6
+ */
7
+
8
+ var tb_pathToImage = "images/loadingAnimation.gif";
9
+
10
+ /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
11
+
12
+ //on page load call tb_init
13
+
14
+
15
+
16
+ jQuery(document).ready(function(){
17
+
18
+ function getBaseURL(loc, end) {
19
+
20
+ var pre, res;
21
+ pre = loc.substring(0, loc.search('index.php'));
22
+ end = tb_pathToImage;
23
+ res = pre + 'skin/adminhtml/default/default/imagerecycle/imagerecycle/' + end;
24
+ return res;
25
+ }
26
+
27
+ tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
28
+ imgLoader = new Image();// preload image
29
+ imgLoader.src = tb_pathToImage;
30
+ imgLoader.src = getBaseURL(imgLoader.src, tb_pathToImage);
31
+
32
+ //alert(imgLoader.src);
33
+ });
34
+
35
+ //add thickbox to href & area elements that have a class of .thickbox
36
+ function tb_init(domChunk){
37
+ jQuery(domChunk).click(function(){
38
+ var t = this.title || this.name || null;
39
+ var a = this.href || this.alt;
40
+ var g = this.rel || false;
41
+ tb_show(t,a,g);
42
+ this.blur();
43
+ return false;
44
+ });
45
+ }
46
+
47
+ function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
48
+
49
+ try {
50
+ if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
51
+ jQuery("body","html").css({height: "100%", width: "100%"});
52
+ jQuery("html").css("overflow","hidden");
53
+ if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
54
+ jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
55
+ jQuery("#TB_overlay").click(tb_remove);
56
+ }
57
+ }else{//all others
58
+ if(document.getElementById("TB_overlay") === null){
59
+ jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
60
+ jQuery("#TB_overlay").click(tb_remove);
61
+ }
62
+ }
63
+
64
+ if(tb_detectMacXFF()){
65
+ jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
66
+ }else{
67
+ jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
68
+ }
69
+
70
+ if(caption===null){caption="";}
71
+ jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' style='position: absolute; left: -50%;' /></div>");//add loader to the page
72
+ jQuery('#TB_load').show();//show loader
73
+
74
+ var baseURL;
75
+ if(url.indexOf("?")!==-1){ //ff there is a query string involved
76
+ baseURL = url.substr(0, url.indexOf("?"));
77
+ }else{
78
+ baseURL = url;
79
+ }
80
+
81
+ var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
82
+ var urlType = baseURL.toLowerCase().match(urlString);
83
+
84
+ if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
85
+
86
+ TB_PrevCaption = "";
87
+ TB_PrevURL = "";
88
+ TB_PrevHTML = "";
89
+ TB_NextCaption = "";
90
+ TB_NextURL = "";
91
+ TB_NextHTML = "";
92
+ TB_imageCount = "";
93
+ TB_FoundURL = false;
94
+ if(imageGroup){
95
+ TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get();
96
+ for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
97
+ var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
98
+ if (!(TB_TempArray[TB_Counter].href == url)) {
99
+ if (TB_FoundURL) {
100
+ TB_NextCaption = TB_TempArray[TB_Counter].title;
101
+ TB_NextURL = TB_TempArray[TB_Counter].href;
102
+ TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
103
+ } else {
104
+ TB_PrevCaption = TB_TempArray[TB_Counter].title;
105
+ TB_PrevURL = TB_TempArray[TB_Counter].href;
106
+ TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
107
+ }
108
+ } else {
109
+ TB_FoundURL = true;
110
+ TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);
111
+ }
112
+ }
113
+ }
114
+
115
+ imgPreloader = new Image();
116
+ imgPreloader.onload = function(){
117
+ imgPreloader.onload = null;
118
+
119
+ // Resizing large images - orginal by Christian Montoya edited by me.
120
+ var pagesize = tb_getPageSize();
121
+ var x = pagesize[0] - 150;
122
+ var y = pagesize[1] - 150;
123
+ var imageWidth = imgPreloader.width;
124
+ var imageHeight = imgPreloader.height;
125
+ if (imageWidth > x) {
126
+ imageHeight = imageHeight * (x / imageWidth);
127
+ imageWidth = x;
128
+ if (imageHeight > y) {
129
+ imageWidth = imageWidth * (y / imageHeight);
130
+ imageHeight = y;
131
+ }
132
+ } else if (imageHeight > y) {
133
+ imageWidth = imageWidth * (y / imageHeight);
134
+ imageHeight = y;
135
+ if (imageWidth > x) {
136
+ imageHeight = imageHeight * (x / imageWidth);
137
+ imageWidth = x;
138
+ }
139
+ }
140
+ // End Resizing
141
+
142
+ TB_WIDTH = imageWidth + 30;
143
+ TB_HEIGHT = imageHeight + 60;
144
+ jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>");
145
+
146
+ jQuery("#TB_closeWindowButton").click(tb_remove);
147
+
148
+ if (!(TB_PrevHTML === "")) {
149
+ function goPrev(){
150
+ if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
151
+ jQuery("#TB_window").remove();
152
+ jQuery("body").append("<div id='TB_window'></div>");
153
+ tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
154
+ return false;
155
+ }
156
+ jQuery("#TB_prev").click(goPrev);
157
+ }
158
+
159
+ if (!(TB_NextHTML === "")) {
160
+ function goNext(){
161
+ jQuery("#TB_window").remove();
162
+ jQuery("body").append("<div id='TB_window'></div>");
163
+ tb_show(TB_NextCaption, TB_NextURL, imageGroup);
164
+ return false;
165
+ }
166
+ jQuery("#TB_next").click(goNext);
167
+
168
+ }
169
+
170
+ document.onkeydown = function(e){
171
+ if (e == null) { // ie
172
+ keycode = event.keyCode;
173
+ } else { // mozilla
174
+ keycode = e.which;
175
+ }
176
+ if(keycode == 27){ // close
177
+ tb_remove();
178
+ } else if(keycode == 190){ // display previous image
179
+ if(!(TB_NextHTML == "")){
180
+ document.onkeydown = "";
181
+ goNext();
182
+ }
183
+ } else if(keycode == 188){ // display next image
184
+ if(!(TB_PrevHTML == "")){
185
+ document.onkeydown = "";
186
+ goPrev();
187
+ }
188
+ }
189
+ };
190
+
191
+ tb_position();
192
+ jQuery("#TB_load").remove();
193
+ jQuery("#TB_ImageOff").click(tb_remove);
194
+ jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
195
+ };
196
+
197
+ imgPreloader.src = url;
198
+ }else{//code to show html
199
+
200
+ var queryString = url.replace(/^[^\?]+\??/,'');
201
+ var params = tb_parseQuery( queryString );
202
+
203
+ TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
204
+ TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
205
+ ajaxContentW = TB_WIDTH - 30;
206
+ ajaxContentH = TB_HEIGHT - 45;
207
+
208
+ if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
209
+ urlNoQuery = url.split('TB_');
210
+ jQuery("#TB_iframeContent").remove();
211
+ if(params['modal'] != "true"){//iframe no modal
212
+ jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
213
+ }else{//iframe modal
214
+ jQuery("#TB_overlay").unbind();
215
+ jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
216
+ }
217
+ }else{// not an iframe, ajax
218
+ if(jQuery("#TB_window").css("display") != "block"){
219
+ if(params['modal'] != "true"){//ajax no modal
220
+ jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
221
+ }else{//ajax modal
222
+ jQuery("#TB_overlay").unbind();
223
+ jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
224
+ }
225
+ }else{//this means the window is already up, we are just loading new content via ajax
226
+ jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
227
+ jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
228
+ jQuery("#TB_ajaxContent")[0].scrollTop = 0;
229
+ jQuery("#TB_ajaxWindowTitle").html(caption);
230
+ }
231
+ }
232
+
233
+ jQuery("#TB_closeWindowButton").click(tb_remove);
234
+
235
+ if(url.indexOf('TB_inline') != -1){
236
+ jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
237
+ jQuery("#TB_window").unload(function () {
238
+ jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
239
+ });
240
+ tb_position();
241
+ jQuery("#TB_load").remove();
242
+ jQuery("#TB_window").css({display:"block"});
243
+ }else if(url.indexOf('TB_iframe') != -1){
244
+ tb_position();
245
+ if(jQuery.browser.safari){//safari needs help because it will not fire iframe onload
246
+ jQuery("#TB_load").remove();
247
+ jQuery("#TB_window").css({display:"block"});
248
+ }
249
+ }else{
250
+ jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
251
+ tb_position();
252
+ jQuery("#TB_load").remove();
253
+ tb_init("#TB_ajaxContent a.thickbox");
254
+ jQuery("#TB_window").css({display:"block"});
255
+ });
256
+ }
257
+
258
+ }
259
+
260
+ if(!params['modal']){
261
+ document.onkeyup = function(e){
262
+ if (e == null) { // ie
263
+ keycode = event.keyCode;
264
+ } else { // mozilla
265
+ keycode = e.which;
266
+ }
267
+ if(keycode == 27){ // close
268
+ tb_remove();
269
+ }
270
+ };
271
+ }
272
+
273
+ } catch(e) {
274
+ //nothing here
275
+ }
276
+ }
277
+
278
+ //helper functions below
279
+ function tb_showIframe(){
280
+ jQuery("#TB_load").remove();
281
+ jQuery("#TB_window").css({display:"block"});
282
+ }
283
+
284
+ function tb_remove() {
285
+ jQuery("#TB_imageOff").unbind("click");
286
+ jQuery("#TB_closeWindowButton").unbind("click");
287
+ jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
288
+ jQuery("#TB_load").remove();
289
+ if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
290
+ jQuery("body","html").css({height: "auto", width: "auto"});
291
+ jQuery("html").css("overflow","");
292
+ }
293
+ document.onkeydown = "";
294
+ document.onkeyup = "";
295
+ return false;
296
+ }
297
+
298
+ function tb_position() {
299
+ jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
300
+ if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
301
+ jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
302
+ }
303
+ }
304
+
305
+ function tb_parseQuery ( query ) {
306
+ var Params = {};
307
+ if ( ! query ) {return Params;}// return empty object
308
+ var Pairs = query.split(/[;&]/);
309
+ for ( var i = 0; i < Pairs.length; i++ ) {
310
+ var KeyVal = Pairs[i].split('=');
311
+ if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
312
+ var key = unescape( KeyVal[0] );
313
+ var val = unescape( KeyVal[1] );
314
+ val = val.replace(/\+/g, ' ');
315
+ Params[key] = val;
316
+ }
317
+ return Params;
318
+ }
319
+
320
+ function tb_getPageSize(){
321
+ var de = document.documentElement;
322
+ var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
323
+ var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
324
+ arrayPageSize = [w,h];
325
+ return arrayPageSize;
326
+ }
327
+
328
+ function tb_detectMacXFF() {
329
+ var userAgent = navigator.userAgent.toLowerCase();
330
+ if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
331
+ return true;
332
+ }
333
+ }
334
+
package.xml CHANGED
@@ -1,42 +1,44 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ImageRecycle_image_pdf_optimize</name>
4
- <version>1.0.6</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>ImageRecycle is an automatic Image and PDF optimizer that speedup the page display</summary>
10
  <description>ImageRecycle is an automatic Image and PDF content optimizer for Magento store. Your customers are waiting for your pages to load, it can takes long, especially on mobile devices. Even content is served fast by the server, slow connection can make your users leaving. &lt;br /&gt;&lt;br /&gt;&#xD;
11
- &#xD;
12
  People are impatient in front a slow loading website, that's the result of a recent study, 4 second loading causing 24% of visitors to leave (Source statistica.com.). Content optimization is more efficient than any other optimization tool.&lt;br /&gt;&lt;br /&gt;&#xD;
13
- &#xD;
14
- &#xD;
15
  &lt;h2&gt;Magento image optimization&lt;/h2&gt;&lt;br /&gt;&#xD;
16
- &#xD;
17
  Images can represent from 60% to 80% of a product page weight, so an optimization can accelerate your shop loading by x3 or more.&#xD;
18
- With an average of 25% of users that leave your website after 4 second of loading page, this is something crucial for your online business. And it's even more important on mobile devices were connection are usually slower.&#xD;
19
  &#xD;
 
20
  &#xD;
21
  &lt;h2&gt;Reduce image and pdf, not quality&lt;/h2&gt;&lt;br /&gt;&#xD;
22
  &#xD;
23
  The jpg, png, gif optimization algorithm is capable of reducing the image size by up to 85% (5x +), while the resulting photos are visually identical to the originals. We believe that image and pdf compression is a matter preserving the quality then reduce the size. Reducing the image and pdf size can be done using a massive compression of data and result a worsened quality. We detect already compressed media and return original files.&#xD;
24
  &#xD;
25
- &#xD;
26
  &lt;h2&gt;Main features:&lt;/h2&gt;&lt;br /&gt;&#xD;
27
  &#xD;
28
  - Compress automatically new images &amp;amp; pdf&#xD;
 
29
  - Compress automatically existing images &amp;amp; pdf&#xD;
 
30
  - Image automatic resizing&#xD;
 
31
  - Define an optimization quality images per media type&#xD;
 
32
  - Define a min-max size to optimize&#xD;
 
33
  - Optimize png, jpg, gif&#xD;
 
34
  - Define optimization quality per file type, jpg, png, gif</description>
35
- <notes>Add ability to resize old images</notes>
 
36
  <authors><author><name>ImageRecycle</name><user>ImageRecycle</user><email>contact@imagerecycle.com</email></author></authors>
37
- <date>2016-01-26</date>
38
- <time>13:14:07</time>
39
- <contents><target name="magecommunity"><dir name="Imagerecycle"><dir name="Imagerecycle"><dir name="Block"><file name="Images.php" hash="e87aada5017900e066c031a73f41c096"/></dir><dir name="Helper"><file name="Data.php" hash="e3311eec7c749f39863537d9b6feaed2"/></dir><dir name="Model"><file name="Observer.php" hash="ecd7abe292e072f6c02badfb8815ba4b"/><dir name="Resource"><dir name="Images"><file name="Collection.php" hash="a8f7aba5403f8469959053630e509898"/></dir><file name="Images.php" hash="82c27d80a05aa3af8329100ad1ca2762"/><file name="Setup.php" hash="7950a28c598f21168a319fcbf7946583"/></dir></dir><dir name="classes"><file name="ioa.class.php" hash="a8f04430a71d4e91bbaff179f4cd6856"/></dir><dir name="controllers"><file name="IndexController.php" hash="c50e39d917942bbd943b8a76531a2f6a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="66cb48702ff1456d6ca9fbff533f3ee4"/><file name="config.xml" hash="ab0471925aa5207520c96453dc34ad42"/></dir><dir name="sql"><dir name="imagerecycle_setup"><file name="mysql4-install-1.0.0.php" hash="e9113b9c19d91ed6cebd34180c90ff76"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="imagerecycle"><dir name="imagerecycle"><file name="bluebox.js" hash="36304b24f301b11d5abc23d6b5c1ef45"/><file name="jquery.min.js" hash="8101d596b2b8fa35fe3a634ea342d7c3"/><file name="script.js" hash="4a3fe3225f3bfc8c54ed591d19e970de"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="imagerecycle"><dir name="imagerecycle"><file name="imagerecycle.css" hash="5c70db79a6e7ac29b0b1e9927ae6f31f"/><dir name="images"><file name="ajax-loader-tr.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/><file name="gift-message-collapse.gif" hash="5b710f5faa9c7352a39c10e3ebbee6fc"/><file name="gift-message-expand.gif" hash="fd53a70cbb1ea048754657a63787e9cb"/><file name="grouped_to_order_icon.png" hash="4bdae9a6199655027b8b8aeee8f80ce4"/><file name="i_question-mark.png" hash="23201b7ac207eebd9be0776ea44098a4"/><file name="pdf.png" hash="9c819141f3537f9f3ea181369332be85"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Imagerecycle_ImageRecycle.xml" hash="a20d14dfe71ec27c3f048cbb2eb03d1d"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="imagerecycle_imagerecycle.xml" hash="f26968bc8644e3e3d7c412a73d7f3ba0"/></dir></dir></dir></dir><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="imagerecycle"><dir name="imagerecycle"><file name="images.phtml" hash="5bfc9e839c069388560292abb074cfd6"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
40
  <compatible/>
41
- <dependencies><required><php><min>5.3.0</min><max>5.6.0</max></php><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
42
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ImageRecycle_image_pdf_optimize</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>ImageRecycle is an automatic Image and PDF optimizer that speedup the page display</summary>
10
  <description>ImageRecycle is an automatic Image and PDF content optimizer for Magento store. Your customers are waiting for your pages to load, it can takes long, especially on mobile devices. Even content is served fast by the server, slow connection can make your users leaving. &lt;br /&gt;&lt;br /&gt;&#xD;
 
11
  People are impatient in front a slow loading website, that's the result of a recent study, 4 second loading causing 24% of visitors to leave (Source statistica.com.). Content optimization is more efficient than any other optimization tool.&lt;br /&gt;&lt;br /&gt;&#xD;
 
 
12
  &lt;h2&gt;Magento image optimization&lt;/h2&gt;&lt;br /&gt;&#xD;
 
13
  Images can represent from 60% to 80% of a product page weight, so an optimization can accelerate your shop loading by x3 or more.&#xD;
 
14
  &#xD;
15
+ With an average of 25% of users that leave your website after 4 second of loading page, this is something crucial for your online business. And it's even more important on mobile devices were connection are usually slower.&#xD;
16
  &#xD;
17
  &lt;h2&gt;Reduce image and pdf, not quality&lt;/h2&gt;&lt;br /&gt;&#xD;
18
  &#xD;
19
  The jpg, png, gif optimization algorithm is capable of reducing the image size by up to 85% (5x +), while the resulting photos are visually identical to the originals. We believe that image and pdf compression is a matter preserving the quality then reduce the size. Reducing the image and pdf size can be done using a massive compression of data and result a worsened quality. We detect already compressed media and return original files.&#xD;
20
  &#xD;
 
21
  &lt;h2&gt;Main features:&lt;/h2&gt;&lt;br /&gt;&#xD;
22
  &#xD;
23
  - Compress automatically new images &amp;amp; pdf&#xD;
24
+ &#xD;
25
  - Compress automatically existing images &amp;amp; pdf&#xD;
26
+ &#xD;
27
  - Image automatic resizing&#xD;
28
+ &#xD;
29
  - Define an optimization quality images per media type&#xD;
30
+ &#xD;
31
  - Define a min-max size to optimize&#xD;
32
+ &#xD;
33
  - Optimize png, jpg, gif&#xD;
34
+ &#xD;
35
  - Define optimization quality per file type, jpg, png, gif</description>
36
+ <notes>Background optimization&#xD;
37
+ Account creation in plugin</notes>
38
  <authors><author><name>ImageRecycle</name><user>ImageRecycle</user><email>contact@imagerecycle.com</email></author></authors>
39
+ <date>2016-06-15</date>
40
+ <time>16:50:25</time>
41
+ <contents><target name="magecommunity"><dir name="Imagerecycle"><dir name="Imagerecycle"><dir name="Block"><file name="Images.php" hash="b5916489e428923cbefd494b07c2c0a9"/><file name="Notifications.php" hash="3ae0284429f2ddbcf63cfeea773a2c9f"/><file name="Settings.php" hash="b35eb42fcfa5252d5d5a07183bd3ff7f"/></dir><dir name="Helper"><file name="Data.php" hash="41b4f1948165518f84c1eb61ad8ecf66"/></dir><dir name="Model"><file name="Notification.php" hash="9d4ae12ea06ffe9ccde7ddfe64a1f479"/><file name="Observer.php" hash="2fb2b19fed27ca284a1512f7d6fe8b78"/><dir name="Resource"><file name="Images.php" hash="a6ebc0e96de89452cc683a17fe4e13f8"/><file name="Setup.php" hash="0040a20420dcb2c6c896d7bc56816de7"/></dir></dir><dir name="classes"><file name="ioa.class.php" hash="18f5a6b91ce6b7480b8645a74016a1b6"/></dir><dir name="controllers"><file name="ImageAllController.php" hash="92adafd3cd6f0a89d942935c7c4141c5"/><file name="IndexController.php" hash="7e54baa31d599b9563c171ad5f06b143"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0776ce36332d75b99f558e885877f012"/><file name="config.xml" hash="f8cddfdfa94223c030d77169113d16da"/></dir><dir name="sql"><dir name="imagerecycle_setup"><file name="mysql4-install-1.0.0.php" hash="f6342691d651243edd4406f6ed7da5a0"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="imagerecycle"><dir name="imagerecycle"><file name="config.js" hash="922198a16d9f80b6f016fac1d8b7fe93"/><file name="jaofiletree.js" hash="e20f8412f596837681953a33d574db10"/><file name="jquery.min.js" hash="e1a1b01a12659ff6530a5b8f2dbb18f8"/><file name="jquery.reveal.js" hash="2e4b47ca455e3327414583a0c77f3e33"/><file name="script.js" hash="af1d346d99ff28b143bcd13e6ba96d9a"/><file name="thickbox.js" hash="5512dbf5f17748621fba6673cd02abff"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="imagerecycle"><dir name="imagerecycle"><file name="imagerecycle.css" hash="0ff281c82cd1de54a2f8ab4abcd7fc04"/><dir name="images"><file name="ajax-loader-tr.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/><file name="application.png" hash="fc517da02d6a64a68e5fea9a5de472f1"/><file name="code.png" hash="c65fadae5a0fc27f401f1a00e66f518f"/><file name="css.png" hash="783f5b06082bf73e9d1eaf79d838162f"/><file name="db.png" hash="03e2b564224bfb58ff20904bda244043"/><file name="directory.png" hash="fbd3929a893b147ae0940d48d533e023"/><file name="doc.png" hash="38af291953d5b90b0aee30dd0d2126a4"/><file name="drive.png" hash="952051985214488bb370ecd21db44c74"/><file name="file.png" hash="a3112ba7e266938321394347e2a6e107"/><file name="film.png" hash="5ad12582e3ca901894737c3dd44a5eb2"/><file name="flash.png" hash="132a505684e7b7b91f50ea29c072112b"/><file name="folder_open.png" hash="bf30d89d69dddfbd8e5f805a199c407f"/><file name="gift-message-collapse.gif" hash="5b710f5faa9c7352a39c10e3ebbee6fc"/><file name="gift-message-expand.gif" hash="fd53a70cbb1ea048754657a63787e9cb"/><file name="grouped_to_order_icon.png" hash="4bdae9a6199655027b8b8aeee8f80ce4"/><file name="html.png" hash="12ace1a918403049a6d2fc152f53baec"/><file name="i_question-mark.png" hash="23201b7ac207eebd9be0776ea44098a4"/><file name="java.png" hash="ac467ef8defc620b6b5eb80d2047bcb7"/><file name="linux.png" hash="73c25b185fb78cc690675cd4a181ee0b"/><file name="loadingAnimation.gif" hash="ce2268030dd2151b63cdf4ffc2f626ba"/><file name="music.png" hash="bd2244ac282a5ada48b0d79cacc59426"/><file name="pdf.png" hash="9c819141f3537f9f3ea181369332be85"/><file name="php.png" hash="48cda2a2a54a31f7a666547c862c12e7"/><file name="picture.png" hash="d2040c34ba1ffd8fa5b72ab37be11eca"/><file name="ppt.png" hash="8c366c11adee3cf2988614df4c96782b"/><file name="psd.png" hash="787a96924e9b114e75f48b540ff480a2"/><file name="ruby.png" hash="661505d2efc05b2347492e4949f564d5"/><file name="script.png" hash="13ad2158a4889c26a851f99b261e4c5c"/><file name="spinner.gif" hash="9a8269421303631316be4ab5e34870e1"/><file name="txt.png" hash="0da66bdb013f9a9d12ce7219e642bc25"/><file name="xls.png" hash="7363cb7630d1d4b441183345fd15ae62"/><file name="zip.png" hash="2eba6780fc7d3663bc44808480c6bd8a"/></dir><file name="jaofiletree.css" hash="6092087d82ceb554b34d75be2ca8bf29"/><file name="reveal.css" hash="21171f730dcf9dc6d4377c88307503c5"/><file name="thickbox.css" hash="f07f045e5a10347a6665a0ac48fda4dc"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="imagerecycle_imagerecycle.xml" hash="01fca7a6d778a604cb009c603c633e13"/></dir><dir name="template"><dir name="imagerecycle"><dir name="imagerecycle"><file name="connect.phtml" hash="7801a43adad2371ef655c12ca645641a"/><file name="images.phtml" hash="f871e9da9d3a08f9df553d21f3f65977"/><file name="listing.phtml" hash="693f22aa6aa7ba43acd69f3fd1b478ec"/><file name="settings.phtml" hash="ae716e4e9cdf3a952d660e94b12b291f"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Imagerecycle_ImageRecycle.xml" hash="965f7990a669fff8ba5bc3fc06d48801"/></dir></target></contents>
42
  <compatible/>
43
+ <dependencies><required><php><min>5.3.0</min><max>5.6.21</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
44
  </package>
skin/adminhtml/default/default/imagerecycle/imagerecycle/imagerecycle.css CHANGED
@@ -1,448 +1,434 @@
1
- /**/
2
- .image-recycle{
3
- table-layout:fixed;
4
- background: #fff;
5
- border: 1px solid #e5e5e5;
6
- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
7
- border-spacing: 0;
8
- clear: both;
9
- margin: 0;
10
- width: 100%;
11
-
12
- }
13
-
14
- .image-recycle *{
15
- word-wrap: break-word;
16
- }
17
-
18
- .image-recycle thead{
19
- padding-top: 10px;
20
- }
21
-
22
- .image-recycle thead th{
23
- border-bottom: 1px solid #e1e1e1;
24
- }
25
- .image-recycle tfoot th{
26
- border-top: 1px solid #e1e1e1;
27
- }
28
-
29
- .image-recycle th{
30
- font-weight: 400;
31
- font-size: 14px;
32
- text-align: left;
33
- }
34
-
35
- .image-recycle tr th img.image-small, .image-recycle tr td img.image-small{
36
- max-width: 100%;
37
- max-height: 100%;
38
- }
39
-
40
- .item-image{
41
- position: relative;
42
- }
43
- .item-image .image-origin{
44
- position: absolute; z-index: 999999;
45
- display:none;
46
- }
47
-
48
-
49
- .image-recycle th, .image-recycle td{
50
- font-weight: 400;
51
- padding: 8px 10px;
52
- height: 35px!important;
53
- }
54
-
55
- .image-recycle thead tr th, .image-recycle tfoot tr th{
56
- color: #333;
57
- }
58
-
59
- .image-recycle thead th, .image-recycle tfoot th{
60
- line-height: 1.4em;
61
- }
62
-
63
- .image-recycle .check-column{
64
- vertical-align: top;
65
- width: 2.2em;
66
- }
67
-
68
- .image-recycle tr.even{
69
- background-color: #f9f9f9;
70
- }
71
-
72
- a.ir-action{
73
- background: none repeat scroll 0 0 #2ea2cc;
74
- border-color: #0074a2;
75
- box-shadow: 0 1px 0 rgba(120, 200, 230, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
76
- color: #fff;
77
- text-decoration: none;
78
- vertical-align: top;
79
- border-radius: 3px;
80
- border-style: solid;
81
- border-width: 1px;
82
- box-sizing: border-box;
83
- cursor: pointer;
84
- display: inline-block;
85
- font-size: 13px;
86
- height: 28px;
87
- line-height: 26px;
88
- margin: 0;
89
- padding: 0 10px 1px;
90
- white-space: nowrap;
91
- transition: none 0s ease 0s ;
92
- outline: 0 none;
93
- }
94
-
95
- a.ir-action:hover{
96
- background: none repeat scroll 0 0 #1e8cbe;
97
- border-color: #0074a2;
98
- box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset;
99
- color: #fff;
100
- }
101
-
102
- a.ir-action:focus{
103
- border-color: #0e3950;
104
- box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset, 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8);
105
- }
106
-
107
- a.ir-action:active{
108
- background: none repeat scroll 0 0 #1b7aa6;
109
- border-color: #005684;
110
- box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1) inset;
111
- color: rgba(255, 255, 255, 0.95);
112
- vertical-align: top;
113
- }
114
-
115
- a.ir-action[disabled], a.ir-action.disabled{
116
- background: none repeat scroll 0 0 #298cba !important;
117
- border-color: #1b607f !important;
118
- box-shadow: none !important;
119
- color: #94cde7 !important;
120
- cursor: not-allowed;
121
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) !important;
122
- }
123
-
124
- .ir-setting{
125
- width: 500px;
126
- padding: 5px 15px;
127
- position: absolute;
128
- top: 30px;
129
- right: 0;
130
- background: #F4F4F4;
131
- border: 2px solid #6699FF;
132
- border-radius: 6px;
133
- display: none;
134
- }
135
- .ir-setting select,.ir-setting option { padding: 2px;}
136
- #ir-setting, #ir-about{
137
- color: #6565cb;
138
- font-weight: bold;
139
- font-size: 12px;
140
- margin-left: 5px;
141
- padding-left: 15px;
142
- text-decoration: none;
143
- }
144
-
145
- #ir-setting{
146
- background: url('images/grouped_to_order_icon.png') no-repeat scroll 0 -1px transparent;
147
- }
148
-
149
- #ir-about{
150
- background: url('images/i_question-mark.png') no-repeat scroll 0 -1px transparent;
151
- }
152
-
153
- table.form-table{
154
- font-size: 14px;
155
- border-collapse: collapse;
156
- clear: both;
157
- margin-top: 0.5em;
158
- width: 100%;
159
- }
160
-
161
- table.form-table th{
162
- font-weight: 600;
163
- line-height: 1.3;
164
- padding: 5px 10px 5px 0;
165
- text-align: left;
166
- vertical-align: top;
167
- width: 100px;
168
- color: #555;
169
- text-shadow: none;
170
- }
171
-
172
- table.form-table td{
173
- line-height: 1.3;
174
- margin-bottom: 9px;
175
- padding: 5px 10px;
176
- vertical-align: middle;
177
- }
178
-
179
- table.form-table td input{
180
- background-color: #fff;
181
- width: 100%;
182
- border: 1px solid #ddd;
183
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07) inset;
184
- color: #333;
185
- outline: 0 none;
186
- transition: border-color 0.05s ease-in-out 0s;
187
- margin: 1px;
188
- padding: 6px 5px;
189
- border-radius: 0;
190
- font-size: 14px;
191
- font-weight: inherit;
192
- box-sizing: border-box;
193
- }
194
- table.form-table td input.resize_auto{
195
- width: auto;
196
- display: inline-block;
197
- }
198
- .visible{
199
- display: block;
200
- }
201
- .hidden{
202
- display: none;
203
- }
204
-
205
- .msg-warning{
206
- border: 1px solid #FF5050;
207
- color: #FF3300;
208
- padding: 5px;
209
- float:left;
210
- }
211
-
212
- .msg-error{
213
- color: #FF3300;
214
- }
215
- .msg-success{
216
- color: #33CC33;
217
- }
218
-
219
- .clear-left{
220
- clear: left;
221
- }
222
-
223
- #ir-setting-msg{
224
- display: none;
225
- float: right;
226
- padding: 5px;
227
- color: #00CC99;
228
- }
229
-
230
- #ir-setting-save{
231
- position: relative;
232
- }
233
- #ir-setting-loader{
234
- display: none;
235
- position: absolute;
236
- top: -5px;
237
- right: -22px;
238
- /*background: url('../images/ajax-loader-tr.gif') scroll no-repeat 0 0 transparent;*/
239
- }
240
-
241
- .scan-msg-box{
242
- pading: 15px;
243
- }
244
- .scan-msg-box > div{
245
- margin-top: 50px;
246
- vertical-align: center;
247
- }
248
- .scan-msg-box p{
249
- font-size: 14px;
250
- margin-top: 6px;
251
- text-align: center;
252
- }
253
-
254
- .pagination-wrapper{
255
- margin:0;
256
- padding: 0 0 10px;
257
- float:right;
258
- }
259
- .pagination{
260
- list-style:none outside none;
261
- margin:0;
262
- padding:0;
263
- }
264
- .pagination {
265
- display: inline-block;
266
- padding-left: 0;
267
- margin: 0;
268
- border-radius: 4px;
269
- }
270
- .pagination > li {
271
- display: inline;
272
- }
273
- .pagination > li > a,
274
- .pagination > li > span {
275
- /*position: relative;*/
276
- float: left;
277
- padding: 6px 12px;
278
- margin-left: -1px;
279
- line-height: 1.42857143;
280
- color: #337ab7;
281
- text-decoration: none;
282
- background-color: #fff;
283
- border: 1px solid #ddd;
284
- }
285
- .pagination > li:first-child > a,
286
- .pagination > li:first-child > span {
287
- margin-left: 0;
288
- border-top-left-radius: 4px;
289
- border-bottom-left-radius: 4px;
290
- }
291
- .pagination > li:last-child > a,
292
- .pagination > li:last-child > span {
293
- border-top-right-radius: 4px;
294
- border-bottom-right-radius: 4px;
295
- }
296
- .pagination > li > a:hover,
297
- .pagination > li > span:hover,
298
- .pagination > li > a:focus,
299
- .pagination > li > span:focus {
300
- color: #23527c;
301
- background-color: #eee;
302
- border-color: #ddd;
303
- }
304
- .pagination > .active > a,
305
- .pagination > .active > span,
306
- .pagination > .active > a:hover,
307
- .pagination > .active > span:hover,
308
- .pagination > .active > a:focus,
309
- .pagination > .active > span:focus {
310
- /*z-index: 2;*/
311
- color: #fff;
312
- cursor: default;
313
- background-color: #2ea2cc;
314
- border-color: #2ea2cc;
315
- }
316
- .pagination > .disabled > span,
317
- .pagination > .disabled > span:hover,
318
- .pagination > .disabled > span:focus,
319
- .pagination > .disabled > a,
320
- .pagination > .disabled > a:hover,
321
- .pagination > .disabled > a:focus {
322
- color: #777;
323
- cursor: not-allowed;
324
- background-color: #fff;
325
- border-color: #ddd;
326
- }
327
-
328
- .pagination > li > a{
329
- padding:5px 10px;
330
- }
331
- .pagination li a.active{
332
- background-color: #eee;
333
- border-color: #ddd;
334
- color: #2a6496;
335
- }
336
-
337
- .ir-bulk-action, .ir-filter-action{
338
- float: left;
339
- display: inline-block;
340
- margin-right: 6px;
341
- max-width: 200px;
342
- padding: 2px;
343
- line-height: 28px;
344
- height: 28px;
345
- vertical-align: middle;
346
- transition: .05s border-color ease-in-out;
347
- box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
348
- background-color: #fff;
349
- border: 1px solid #ddd;
350
- color: #333;
351
- font-family: "Open Sans",sans-serif!important;
352
- font-size: 14px;
353
- outline: 0;
354
- cursor: default;
355
- }
356
-
357
- .ir-bulk-action option{
358
- display: block;
359
- padding: 3px 2px 1px;
360
- white-space: pre;
361
- min-height: 1.2em;
362
- cursor: default;
363
- font: inherit;
364
- }
365
-
366
- .do-bulk-action, .do-filter-action{
367
- align-items: flex-start;
368
- text-align: center;
369
- margin: 0 8px 0 0;
370
- padding: 0 10px 1px;
371
- color: #555;
372
- border-color: #ccc;
373
- border-radius: 3px;
374
- background: #f7f7f7;
375
- box-sizing: border-box;
376
- box-shadow: inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);
377
- vertical-align: top;
378
- -webkit-appearance: push-button;
379
- -webkit-user-select: none;
380
- white-space: nowrap;
381
- display: inline-block;
382
- text-decoration: none;
383
- font-size: 13px;
384
- font-weight: normal;
385
- line-height: 26px;
386
- height: 28px;
387
- }
388
-
389
- .do-bulk-action:hover, .do-bulk-action:active, .do-filter-action:hover, .do-filter-action:active{
390
- background: #fafafa;
391
- border-color: #999;
392
- }
393
-
394
- .highlight-input[type="checkbox"]:before{
395
- position: relative;
396
- display: block;
397
- width: 11px;
398
- height: 11px;
399
- border: 1px solid #808080;
400
- content: "";
401
- background-color: #FF3300;
402
- transition-duration: 1s;
403
- transition-property: background-color;
404
- }
405
-
406
- .ir-arrow-up, .ir-arrow-down{
407
- display: inline-block;
408
- margin-top: 1px;
409
- width: 8px;
410
- height: 12px;
411
- cursor: pointer;
412
- }
413
- .ir-arrow-up{
414
- background: url('images/gift-message-collapse.gif') no-repeat scroll center transparent;
415
- }
416
- .ir-arrow-down{
417
- background: url('images/gift-message-expand.gif') no-repeat scroll center transparent;
418
- }
419
-
420
- #mageio_wait {
421
- position: fixed;
422
- top: 120px;
423
- bottom: 0;
424
- left: 25px;
425
- right: 0;
426
- z-index: 100;
427
- }
428
- #mageio_wait::after {
429
- background: #333 url(images/ajax-loader-tr.gif) 50% 55% no-repeat;
430
- opacity: 0.5;
431
- content: "";
432
- top: 0;
433
- left: 0;
434
- bottom: 0;
435
- right: 0;
436
- position: absolute;
437
- z-index: 99;
438
- }
439
- #mageio_wait div {
440
- position: absolute;
441
- top: 40%;
442
- text-align: center;
443
- width: 100%;
444
- font-weight: bold;
445
- font-size: 30px;
446
- line-height: 30px;
447
- color: #444;
448
- }
1
+ /**/
2
+ .content-header h3 {
3
+ color: #009999;
4
+ }
5
+
6
+ h4 {
7
+ font-size: 1.45em;
8
+ }
9
+
10
+ .image-recycle{
11
+ table-layout:fixed;
12
+ background: #fff;
13
+ border: 1px solid #e5e5e5;
14
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
15
+ border-spacing: 0;
16
+ clear: both;
17
+ margin: 10px 0;
18
+ width: 100%;
19
+
20
+ }
21
+
22
+ .image-recycle *{
23
+ word-wrap: break-word;
24
+ }
25
+
26
+ .image-recycle thead{
27
+ padding-top: 10px;
28
+ }
29
+
30
+ .image-recycle thead th{
31
+ border-bottom: 1px solid #e1e1e1;
32
+ }
33
+ .image-recycle tfoot th{
34
+ border-top: 1px solid #e1e1e1;
35
+ }
36
+
37
+ .image-recycle th{
38
+ font-weight: 400;
39
+ font-size: 14px;
40
+ text-align: left;
41
+ }
42
+
43
+ .image-recycle tr th img.image-small, .image-recycle tr td img.image-small{
44
+ max-width: 100%;
45
+ max-height: 100%;
46
+ }
47
+
48
+ .item-image{
49
+ position: relative;
50
+ }
51
+ .item-image .image-origin{
52
+ position: absolute; z-index: 999999;
53
+ display:none;
54
+ }
55
+
56
+
57
+ .image-recycle th, .image-recycle td{
58
+ font-weight: 400;
59
+ padding: 8px 10px;
60
+ height: 35px!important;
61
+ }
62
+
63
+ .image-recycle thead tr th, .image-recycle tfoot tr th{
64
+ color: #333;
65
+ }
66
+
67
+ .image-recycle thead th, .image-recycle tfoot th{
68
+ line-height: 1.4em;
69
+ }
70
+
71
+ .image-recycle .check-column{
72
+ vertical-align: top;
73
+ width: 2.2em;
74
+ }
75
+
76
+ .image-recycle tr.even{
77
+ background-color: #f9f9f9;
78
+ }
79
+
80
+ .imagerecycle-container .button{
81
+ background: none repeat scroll 0 0 #2ea2cc;
82
+ border-color: #0074a2;
83
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
84
+ color: #fff;
85
+ text-decoration: none;
86
+ vertical-align: top;
87
+ border-radius: 3px;
88
+ border-style: solid;
89
+ border-width: 1px;
90
+ box-sizing: border-box;
91
+ cursor: pointer;
92
+ display: inline-block;
93
+ font-size: 13px;
94
+ height: 28px;
95
+ line-height: 26px;
96
+ margin: 2px 0 0 0;
97
+ padding: 0 10px 1px;
98
+ white-space: nowrap;
99
+ transition: none 0s ease 0s ;
100
+ outline: 0 none;
101
+ font-weight: normal;
102
+ }
103
+
104
+ .imagerecycle-container .button:hover{
105
+ background: none repeat scroll 0 0 #1e8cbe;
106
+ border-color: #0074a2;
107
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset;
108
+ color: #fff;
109
+ }
110
+
111
+ .imagerecycle-container .button:focus{
112
+ border-color: #0e3950;
113
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset, 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8);
114
+ }
115
+
116
+ .imagerecycle-container .button:active{
117
+ background: none repeat scroll 0 0 #1b7aa6;
118
+ border-color: #005684;
119
+ box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1) inset;
120
+ color: rgba(255, 255, 255, 0.95);
121
+ vertical-align: top;
122
+ }
123
+
124
+ .imagerecycle-container .button[disabled], .button.disabled{
125
+ background: none repeat scroll 0 0 #298cba !important;
126
+ border-color: #1b607f !important;
127
+ box-shadow: none !important;
128
+ color: #94cde7 !important;
129
+ cursor: not-allowed;
130
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) !important;
131
+ }
132
+
133
+ .ir-setting-group {
134
+ float : right;
135
+ }
136
+
137
+ .icon-setting {
138
+ background: url('images/grouped_to_order_icon.png') no-repeat scroll 0 -1px transparent;
139
+ height: 20px;
140
+ width: 20px;
141
+ float: left;
142
+ margin-top: 6px;
143
+ }
144
+
145
+
146
+ table.form-table{
147
+ font-size: 14px;
148
+ border-collapse: collapse;
149
+ clear: both;
150
+ margin-top: 0.5em;
151
+ width: 70%;
152
+ }
153
+
154
+ table.form-table th{
155
+ font-weight: 600;
156
+ line-height: 1.3;
157
+ padding: 5px 10px 5px 0;
158
+ text-align: left;
159
+ vertical-align: top;
160
+ width: 350px;
161
+ color: #555;
162
+ text-shadow: none;
163
+ }
164
+
165
+ table.form-table td{
166
+ line-height: 1.3;
167
+ margin-bottom: 9px;
168
+ padding: 5px 10px;
169
+ vertical-align: middle;
170
+ }
171
+
172
+ .imagerecycle-container input, .imagerecycle-container select {
173
+ background-color: #fff;
174
+ width: 80%; /**/
175
+ border: 1px solid #ddd;
176
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07) inset;
177
+ color: #333;
178
+ outline: 0 none;
179
+ transition: border-color 0.05s ease-in-out 0s;
180
+ margin: 1px;
181
+ padding: 6px 5px;
182
+ border-radius: 0;
183
+ font-size: 14px;
184
+ font-weight: inherit;
185
+ box-sizing: border-box;
186
+ }
187
+ .imagerecycle-container input.resize_auto{
188
+ width: auto;
189
+ display: inline-block;
190
+ }
191
+
192
+ .msg-warning{
193
+ border: 1px solid #FF5050;
194
+ color: #FF3300;
195
+ padding: 5px;
196
+ float:left;
197
+ }
198
+
199
+ .msg-error{
200
+ color: #FF3300;
201
+ }
202
+ .msg-success{
203
+ color: #33CC33;
204
+ }
205
+
206
+ .clear-left{
207
+ clear: left;
208
+ }
209
+
210
+ .scan-msg-box{
211
+ pading: 15px;
212
+ }
213
+ .scan-msg-box > div{
214
+ margin-top: 50px;
215
+ vertical-align: center;
216
+ }
217
+ .scan-msg-box p{
218
+ font-size: 14px;
219
+ margin-top: 6px;
220
+ text-align: center;
221
+ }
222
+
223
+ .ir-bulk-action {
224
+ width : 200px !important;
225
+ }
226
+
227
+ /*************************** Start of quota **************************/
228
+
229
+ .ir-progress-wrap {
230
+ display: block !important;
231
+ width: 50%;
232
+ float: left;
233
+ max-width: 100%;
234
+ background: #8ac0fd;
235
+ line-height: 1 !important;
236
+ margin: 1px 10px 25px 0;
237
+ position: relative !important;
238
+ box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.03) inset !important;
239
+ -moz-box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.03) inset !important;
240
+ -webkit-box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.03) inset !important;
241
+ }
242
+
243
+ .ir-progress-bar {
244
+ width: 0%;
245
+ display: block !important;
246
+ background: #308ffa;
247
+ height: 30px !important;
248
+ box-sizing: border-box !important;
249
+ -webkit-box-sizing: border-box !important;
250
+ -moz-box-sizing: border-box !important;
251
+ }
252
+
253
+ .ir-progress-wrap span {
254
+ position: absolute !important;
255
+ left: 10px !important;
256
+ top: 10px !important;
257
+ font-size: 12px !important;
258
+ color: #fff;
259
+ line-height: 1 !important;
260
+ }
261
+
262
+ .get-quota-btn {
263
+ margin-left: 20px;
264
+ margin-top : 11px;
265
+ }
266
+
267
+
268
+ /*************************** End of quota **************************/
269
+
270
+ .remove_tag{
271
+ color: #DD3B96;
272
+ }
273
+
274
+ .image-recycle-label{
275
+ padding: 3px 10px 3px;
276
+ white-space: pre;
277
+ cursor: default;
278
+ font: inherit;
279
+ line-height: 30px;
280
+ }
281
+
282
+ .display-time .error{
283
+ margin-left: 30px;
284
+ }
285
+
286
+ .imagerecycle-container .do-search {
287
+ margin-top : 2px;
288
+ }
289
+
290
+ .highlight-input[type="checkbox"]:before{
291
+ position: relative;
292
+ display: block;
293
+ width: 11px;
294
+ height: 11px;
295
+ border: 1px solid #808080;
296
+ content: "";
297
+ background-color: #FF3300;
298
+ transition-duration: 1s;
299
+ transition-property: background-color;
300
+ }
301
+
302
+ .ir-arrow-up, .ir-arrow-down{
303
+ display: inline-block;
304
+ margin-top: 1px;
305
+ width: 8px;
306
+ height: 12px;
307
+ cursor: pointer;
308
+ }
309
+ .ir-arrow-up{
310
+ background: url('images/gift-message-collapse.gif') no-repeat scroll center transparent;
311
+ }
312
+ .ir-arrow-down{
313
+ background: url('images/gift-message-expand.gif') no-repeat scroll center transparent;
314
+ }
315
+
316
+ #mageio_wait {
317
+ position: fixed;
318
+ top: 120px;
319
+ bottom: 0;
320
+ left: 25px;
321
+ right: 0;
322
+ z-index: 100;
323
+ }
324
+
325
+ #mageio_wait::after {
326
+ background: #333 url(images/ajax-loader-tr.gif) 50% 55% no-repeat;
327
+ opacity: 0.5;
328
+ content: "";
329
+ top: 0;
330
+ left: 0;
331
+ bottom: 0;
332
+ right: 0;
333
+ position: absolute;
334
+ z-index: 99;
335
+ }
336
+
337
+ #mageio_wait div {
338
+ position: absolute;
339
+ top: 40%;
340
+ text-align: center;
341
+ width: 100%;
342
+ font-weight: bold;
343
+ font-size: 30px;
344
+ line-height: 30px;
345
+ color: #444;
346
+ }
347
+
348
+ /******************** Start of pagination ********************/
349
+
350
+ .pagination-wrapper{
351
+ margin:0;
352
+ padding: 0 0 10px;
353
+ float:right;
354
+ }
355
+ .pagination{
356
+ list-style:none outside none;
357
+ margin:0;
358
+ padding:0;
359
+ }
360
+ .pagination {
361
+ display: inline-block;
362
+ padding-left: 0;
363
+ margin: 0;
364
+ border-radius: 4px;
365
+ }
366
+ .pagination > li {
367
+ display: inline;
368
+ }
369
+ .pagination > li > a,
370
+ .pagination > li > span {
371
+ /*position: relative;*/
372
+ float: left;
373
+ padding: 6px 12px;
374
+ margin-left: -1px;
375
+ line-height: 1.42857143;
376
+ color: #337ab7;
377
+ text-decoration: none;
378
+ background-color: #fff;
379
+ border: 1px solid #ddd;
380
+ }
381
+ .pagination > li:first-child > a,
382
+ .pagination > li:first-child > span {
383
+ margin-left: 0;
384
+ border-top-left-radius: 4px;
385
+ border-bottom-left-radius: 4px;
386
+ }
387
+ .pagination > li:last-child > a,
388
+ .pagination > li:last-child > span {
389
+ border-top-right-radius: 4px;
390
+ border-bottom-right-radius: 4px;
391
+ }
392
+ .pagination > li > a:hover,
393
+ .pagination > li > span:hover,
394
+ .pagination > li > a:focus,
395
+ .pagination > li > span:focus {
396
+ color: #23527c;
397
+ background-color: #eee;
398
+ border-color: #ddd;
399
+ }
400
+ .pagination > .active > a,
401
+ .pagination > .active > span,
402
+ .pagination > .active > a:hover,
403
+ .pagination > .active > span:hover,
404
+ .pagination > .active > a:focus,
405
+ .pagination > .active > span:focus {
406
+ /*z-index: 2;*/
407
+ color: #fff;
408
+ cursor: default;
409
+ background-color: #2ea2cc;
410
+ border-color: #2ea2cc;
411
+ }
412
+ .pagination > .disabled > span,
413
+ .pagination > .disabled > span:hover,
414
+ .pagination > .disabled > span:focus,
415
+ .pagination > .disabled > a,
416
+ .pagination > .disabled > a:hover,
417
+ .pagination > .disabled > a:focus {
418
+ color: #777;
419
+ cursor: not-allowed;
420
+ background-color: #fff;
421
+ border-color: #ddd;
422
+ }
423
+
424
+ .pagination > li > a{
425
+ padding:5px 10px;
426
+ }
427
+
428
+ .pagination li a.active{
429
+ background-color: #eee;
430
+ border-color: #ddd;
431
+ color: #2a6496;
432
+ }
433
+
434
+ /******************** End of pagination ********************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/application.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/code.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/css.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/db.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/directory.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/doc.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/drive.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/file.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/film.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/flash.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/folder_open.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/html.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/java.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/linux.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/loadingAnimation.gif ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/music.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/php.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/picture.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/ppt.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/psd.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/ruby.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/script.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/spinner.gif ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/txt.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/xls.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/images/zip.png ADDED
Binary file
skin/adminhtml/default/default/imagerecycle/imagerecycle/jaofiletree.css ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wpio_foldertree {
2
+ padding: 10px;
3
+ }
4
+
5
+ ul.wpio_jaofoldertree {
6
+ font-family: Verdana, sans-serif;
7
+ font-size: 11px;
8
+ line-height: 18px;
9
+ padding: 0;
10
+ margin: 0 !important;
11
+ }
12
+
13
+ ul.wpio_jaofoldertree li {
14
+ list-style: none;
15
+ padding: 0px;
16
+ padding-left: 20px;
17
+ margin: 0px;
18
+ white-space: nowrap;
19
+ }
20
+
21
+ ul.wpio_jaofoldertree a {
22
+ color: #333;
23
+ text-decoration: none;
24
+ display: inline-block;
25
+ padding: 0px 2px;
26
+ }
27
+
28
+ ul.wpio_jaofoldertree a:hover {
29
+ font-weight: bold;
30
+ }
31
+
32
+ ul.wpio_jaofoldertree li.selected > a {
33
+ font-weight: bold;
34
+ }
35
+
36
+ /* Core Styles */
37
+ .wpio_jaofoldertree li.wpio_directory { background: url(images/directory.png) left top no-repeat; }
38
+ .wpio_jaofoldertree li.expanded { background: url(images/folder_open.png) left top no-repeat; }
39
+ .wpio_jaofoldertree li.drive { background: url(images/drive.png) left top no-repeat; }
40
+ .wpio_jaofoldertree li.file { background: url(images/file.png) left top no-repeat; }
41
+ .wpio_jaofoldertree li.wait { background: url(images/spinner.gif) left top no-repeat; }
42
+ /* File Extensions*/
43
+ .wpio_jaofoldertree li.ext_3gp { background: url(images/film.png) left top no-repeat; }
44
+ .wpio_jaofoldertree li.ext_afp { background: url(images/code.png) left top no-repeat; }
45
+ .wpio_jaofoldertree li.ext_afpa { background: url(images/code.png) left top no-repeat; }
46
+ .wpio_jaofoldertree li.ext_asp { background: url(images/code.png) left top no-repeat; }
47
+ .wpio_jaofoldertree li.ext_aspx { background: url(images/code.png) left top no-repeat; }
48
+ .wpio_jaofoldertree li.ext_avi { background: url(images/film.png) left top no-repeat; }
49
+ .wpio_jaofoldertree li.ext_bat { background: url(images/application.png) left top no-repeat; }
50
+ .wpio_jaofoldertree li.ext_bmp { background: url(images/picture.png) left top no-repeat; }
51
+ .wpio_jaofoldertree li.ext_c { background: url(images/code.png) left top no-repeat; }
52
+ .wpio_jaofoldertree li.ext_cfm { background: url(images/code.png) left top no-repeat; }
53
+ .wpio_jaofoldertree li.ext_cgi { background: url(images/code.png) left top no-repeat; }
54
+ .wpio_jaofoldertree li.ext_com { background: url(images/application.png) left top no-repeat; }
55
+ .wpio_jaofoldertree li.ext_cpp { background: url(images/code.png) left top no-repeat; }
56
+ .wpio_jaofoldertree li.ext_css { background: url(images/css.png) left top no-repeat; }
57
+ .wpio_jaofoldertree li.ext_doc { background: url(images/doc.png) left top no-repeat; }
58
+ .wpio_jaofoldertree li.ext_exe { background: url(images/application.png) left top no-repeat; }
59
+ .wpio_jaofoldertree li.ext_gif { background: url(images/picture.png) left top no-repeat; }
60
+ .wpio_jaofoldertree li.ext_fla { background: url(images/flash.png) left top no-repeat; }
61
+ .wpio_jaofoldertree li.ext_h { background: url(images/code.png) left top no-repeat; }
62
+ .wpio_jaofoldertree li.ext_htm { background: url(images/html.png) left top no-repeat; }
63
+ .wpio_jaofoldertree li.ext_html { background: url(images/html.png) left top no-repeat; }
64
+ .wpio_jaofoldertree li.ext_jar { background: url(images/java.png) left top no-repeat; }
65
+ .wpio_jaofoldertree li.ext_jpg { background: url(images/picture.png) left top no-repeat; }
66
+ .wpio_jaofoldertree li.ext_jpeg { background: url(images/picture.png) left top no-repeat; }
67
+ .wpio_jaofoldertree li.ext_js { background: url(images/script.png) left top no-repeat; }
68
+ .wpio_jaofoldertree li.ext_lasso { background: url(images/code.png) left top no-repeat; }
69
+ .wpio_jaofoldertree li.ext_log { background: url(images/txt.png) left top no-repeat; }
70
+ .wpio_jaofoldertree li.ext_m4p { background: url(images/music.png) left top no-repeat; }
71
+ .wpio_jaofoldertree li.ext_mov { background: url(images/film.png) left top no-repeat; }
72
+ .wpio_jaofoldertree li.ext_mp3 { background: url(images/music.png) left top no-repeat; }
73
+ .wpio_jaofoldertree li.ext_mp4 { background: url(images/film.png) left top no-repeat; }
74
+ .wpio_jaofoldertree li.ext_mpg { background: url(images/film.png) left top no-repeat; }
75
+ .wpio_jaofoldertree li.ext_mpeg { background: url(images/film.png) left top no-repeat; }
76
+ .wpio_jaofoldertree li.ext_ogg { background: url(images/music.png) left top no-repeat; }
77
+ .wpio_jaofoldertree li.ext_pcx { background: url(images/picture.png) left top no-repeat; }
78
+ .wpio_jaofoldertree li.ext_pdf { background: url(images/pdf.png) left top no-repeat; }
79
+ .wpio_jaofoldertree li.ext_php { background: url(images/php.png) left top no-repeat; }
80
+ .wpio_jaofoldertree li.ext_png { background: url(images/picture.png) left top no-repeat; }
81
+ .wpio_jaofoldertree li.ext_ppt { background: url(images/ppt.png) left top no-repeat; }
82
+ .wpio_jaofoldertree li.ext_psd { background: url(images/psd.png) left top no-repeat; }
83
+ .wpio_jaofoldertree li.ext_pl { background: url(images/script.png) left top no-repeat; }
84
+ .wpio_jaofoldertree li.ext_py { background: url(images/script.png) left top no-repeat; }
85
+ .wpio_jaofoldertree li.ext_rb { background: url(images/ruby.png) left top no-repeat; }
86
+ .wpio_jaofoldertree li.ext_rbx { background: url(images/ruby.png) left top no-repeat; }
87
+ .wpio_jaofoldertree li.ext_rhtml { background: url(images/ruby.png) left top no-repeat; }
88
+ .wpio_jaofoldertree li.ext_rpm { background: url(images/linux.png) left top no-repeat; }
89
+ .wpio_jaofoldertree li.ext_ruby { background: url(images/ruby.png) left top no-repeat; }
90
+ .wpio_jaofoldertree li.ext_sql { background: url(images/db.png) left top no-repeat; }
91
+ .wpio_jaofoldertree li.ext_swf { background: url(images/flash.png) left top no-repeat; }
92
+ .wpio_jaofoldertree li.ext_tif { background: url(images/picture.png) left top no-repeat; }
93
+ .wpio_jaofoldertree li.ext_tiff { background: url(images/picture.png) left top no-repeat; }
94
+ .wpio_jaofoldertree li.ext_txt { background: url(images/txt.png) left top no-repeat; }
95
+ .wpio_jaofoldertree li.ext_vb { background: url(images/code.png) left top no-repeat; }
96
+ .wpio_jaofoldertree li.ext_wav { background: url(images/music.png) left top no-repeat; }
97
+ .wpio_jaofoldertree li.ext_wmv { background: url(images/film.png) left top no-repeat; }
98
+ .wpio_jaofoldertree li.ext_xls { background: url(images/xls.png) left top no-repeat; }
99
+ .wpio_jaofoldertree li.ext_xml { background: url(images/code.png) left top no-repeat; }
100
+ .wpio_jaofoldertree li.ext_zip { background: url(images/zip.png) left top no-repeat; }
101
+
102
+ .wpio_jaofoldertree input[type="checkbox"] {
103
+ width: 0.65rem;
104
+ height: 0.65rem;
105
+ min-width: 0.65rem;
106
+ margin: 4px 4px 0 0 ;
107
+ }
108
+ .wpio_jaofoldertree input[type=checkbox]:checked:before {
109
+ content: none
110
+ }
111
+
112
+ .wpio_jaofoldertree li.wpio_directory {
113
+ position: relative;
114
+ }
115
+ .wpio_jaofoldertree li.wpio_directory input[type="checkbox"] {
116
+ position: absolute;
117
+ }
118
+ .wpio_jaofoldertree li.wpio_directory span.check {
119
+ width: 0.8rem;
120
+ height: 0.8rem;
121
+ background-color: #FFF;
122
+ border: 1px solid #999;
123
+ padding: 0px;
124
+ position: relative;
125
+ display: inline-block;
126
+ vertical-align: middle;
127
+ }
128
+ .wpio_jaofoldertree li.wpio_directory span.check.pchecked {
129
+ display: inline-block;
130
+ }
131
+ .wpio_jaofoldertree span.check.pchecked::after {
132
+ position: absolute;
133
+ display: block;
134
+ content: "";
135
+ background-color: #1D1D1D;
136
+ height: 0.375rem;
137
+ width: 0.375rem;
138
+ left: 50%;
139
+ top: 50%;
140
+ margin-left: -0.1875rem;
141
+ margin-top: -0.1875rem;
142
+ }
143
+ .wpio_jaofoldertree span.check.checked::before {
144
+ position: absolute;
145
+ vertical-align: middle;
146
+ color: transparent;
147
+ font-size: 0px;
148
+ content: "";
149
+ height: 0.3125rem;
150
+ width: 0.565rem;
151
+ background-color: transparent;
152
+ border-left: 0.1875rem solid transparent;
153
+ border-bottom: 0.1875rem solid transparent;
154
+ border-color: transparent;
155
+ left: 50%;
156
+ top: 50%;
157
+ margin-left: -0.325rem;
158
+ margin-top: -0.365rem;
159
+ display: block;
160
+ transform: rotate(-45deg);
161
+ transition: all 0.2s linear 0s;
162
+ width: 6px;
163
+ height: 3px;
164
+ margin-left: -4px;
165
+ margin-top: -4px;
166
+ border-width: 2px;
167
+ border-color: #555;
168
+ }
skin/adminhtml/default/default/imagerecycle/imagerecycle/reveal.css ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* --------------------------------------------------
2
+ Reveal Modals
3
+ -------------------------------------------------- */
4
+
5
+ .reveal-modal-bg {
6
+ position: fixed;
7
+ height: 100%;
8
+ width: 100%;
9
+ background: #000;
10
+ background: rgba(0,0,0,.8);
11
+ z-index: 100;
12
+ display: none;
13
+ top: 0;
14
+ left: 0;
15
+ }
16
+
17
+ .reveal-modal {
18
+ visibility: hidden;
19
+ top: 100px;
20
+ left: 50%;
21
+ margin-left: -300px;
22
+ width: auto;
23
+ background: #eee no-repeat -200px -80px;
24
+ position: absolute;
25
+ z-index: 101;
26
+ padding: 30px 40px 34px;
27
+ -moz-border-radius: 5px;
28
+ -webkit-border-radius: 5px;
29
+ border-radius: 5px;
30
+ -moz-box-shadow: 0 0 10px rgba(0,0,0,.4);
31
+ -webkit-box-shadow: 0 0 10px rgba(0,0,0,.4);
32
+ -box-shadow: 0 0 10px rgba(0,0,0,.4);
33
+ }
34
+
35
+ .reveal-modal.small { width: 200px; margin-left: -140px;}
36
+ .reveal-modal.medium { width: 400px; margin-left: -240px;}
37
+ .reveal-modal.large { width: 600px; margin-left: -340px;}
38
+ .reveal-modal.xlarge { width: 800px; margin-left: -440px;}
skin/adminhtml/default/default/imagerecycle/imagerecycle/thickbox.css ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ----------------------------------------------------------------------------------------------------------------*/
2
+ /* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
3
+ /* ----------------------------------------------------------------------------------------------------------------*/
4
+ *{padding: 0; margin: 0;}
5
+ /* ----------------------------------------------------------------------------------------------------------------*/
6
+ /* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
7
+ /* ----------------------------------------------------------------------------------------------------------------*/
8
+ #TB_window {
9
+ font: 12px Arial, Helvetica, sans-serif;
10
+ color: #333333;
11
+ }
12
+ #TB_secondLine {
13
+ font: 10px Arial, Helvetica, sans-serif;
14
+ color:#666666;
15
+ }
16
+ #TB_window a:link {color: #666666;}
17
+ #TB_window a:visited {color: #666666;}
18
+ #TB_window a:hover {color: #000;}
19
+ #TB_window a:active {color: #666666;}
20
+ #TB_window a:focus{color: #666666;}
21
+ /* ----------------------------------------------------------------------------------------------------------------*/
22
+ /* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
23
+ /* ----------------------------------------------------------------------------------------------------------------*/
24
+ #TB_overlay {
25
+ position: fixed;
26
+ z-index:100;
27
+ top: 0px;
28
+ left: 0px;
29
+ height:100%;
30
+ width:100%;
31
+ }
32
+ .TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;}
33
+ .TB_overlayBG {
34
+ background-color:#000;
35
+ filter:alpha(opacity=75);
36
+ -moz-opacity: 0.75;
37
+ opacity: 0.75;
38
+ }
39
+ * html #TB_overlay { /* ie6 hack */
40
+ position: absolute;
41
+ height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
42
+ }
43
+ #TB_window {
44
+ position: fixed;
45
+ background: #ffffff;
46
+ z-index: 102;
47
+ color:#000000;
48
+ display:none;
49
+ border: 4px solid #525252;
50
+ text-align:left;
51
+ top:50%;
52
+ left:50%;
53
+ }
54
+ * html #TB_window { /* ie6 hack */
55
+ position: absolute;
56
+ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
57
+ }
58
+ #TB_window img#TB_Image {
59
+ display:block;
60
+ margin: 15px 0 0 15px;
61
+ border-right: 1px solid #ccc;
62
+ border-bottom: 1px solid #ccc;
63
+ border-top: 1px solid #666;
64
+ border-left: 1px solid #666;
65
+ }
66
+ #TB_caption{
67
+ height:25px;
68
+ padding:7px 30px 10px 25px;
69
+ float:left;
70
+ }
71
+ #TB_closeWindow{
72
+ height:25px;
73
+ padding:11px 25px 10px 0;
74
+ float:right;
75
+ }
76
+ #TB_closeAjaxWindow{
77
+ padding:7px 10px 5px 0;
78
+ margin-bottom:1px;
79
+ text-align:right;
80
+ float:right;
81
+ }
82
+ #TB_ajaxWindowTitle{
83
+ float:left;
84
+ padding:7px 0 5px 10px;
85
+ margin-bottom:1px;
86
+ }
87
+ #TB_title{
88
+ background-color:#e8e8e8;
89
+ height:27px;
90
+ }
91
+ #TB_ajaxContent{
92
+ clear:both;
93
+ padding:2px 15px 15px 15px;
94
+ overflow:auto;
95
+ text-align:left;
96
+ line-height:1.4em;
97
+ }
98
+ #TB_ajaxContent.TB_modal{
99
+ padding:15px;
100
+ }
101
+ #TB_ajaxContent p{
102
+ padding:5px 0px 5px 0px;
103
+ }
104
+ #TB_load{
105
+ position: fixed;
106
+ display:none;
107
+ height:13px;
108
+ width:208px;
109
+ z-index:103;
110
+ top: 50%;
111
+ left: 50%;
112
+ margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
113
+ }
114
+ * html #TB_load { /* ie6 hack */
115
+ position: absolute;
116
+ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
117
+ }
118
+ #TB_HideSelect{
119
+ z-index:99;
120
+ position:fixed;
121
+ top: 0;
122
+ left: 0;
123
+ background-color:#fff;
124
+ border:none;
125
+ filter:alpha(opacity=0);
126
+ -moz-opacity: 0;
127
+ opacity: 0;
128
+ height:100%;
129
+ width:100%;
130
+ }
131
+ * html #TB_HideSelect { /* ie6 hack */
132
+ position: absolute;
133
+ height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
134
+ }
135
+ #TB_iframeContent{
136
+ clear:both;
137
+ border:none;
138
+ margin-bottom:-1px;
139
+ margin-top:1px;
140
+ _margin-bottom:1px;
141
+ }
142
+
143
+ How to Impleme