Masonry_Responsive_Image_Gallery - Version 1.0.5

Version Notes

>> Resolved directory path issue
>> Images loader JS

Download this release

Release Info

Developer Vsourz Digital
Extension Masonry_Responsive_Image_Gallery
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.3 to 1.0.5

app/code/community/Vsourz/Imagegallery/Block/Adminhtml/Imagegallery/Renderer/Catimage.php CHANGED
@@ -6,7 +6,7 @@ Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
6
  if($value == NULL){
7
  return "No category image defined";
8
  }else{
9
- return '<img width="200" height="100" src="'.Mage::getBaseUrl('media').DS.$value . '" />';
10
  }
11
  }
12
  }
6
  if($value == NULL){
7
  return "No category image defined";
8
  }else{
9
+ return '<img width="200" height="100" src="'.Mage::getBaseUrl('media').$value . '" />';
10
  }
11
  }
12
  }
app/code/community/Vsourz/Imagegallery/Block/Adminhtml/Imagegallery/Renderer/Image.php CHANGED
@@ -6,7 +6,7 @@ Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
6
  if($value == NULL){
7
  return "Image not inserted";
8
  }else{
9
- return '<img width="200" height="100" src="'.Mage::getBaseUrl('media').DS.$value . '" />';
10
  }
11
  }
12
  }
6
  if($value == NULL){
7
  return "Image not inserted";
8
  }else{
9
+ return '<img width="200" height="100" src="'.Mage::getBaseUrl('media').$value . '" />';
10
  }
11
  }
12
  }
app/code/community/Vsourz/Imagegallery/Model/Categoryval.php CHANGED
@@ -4,7 +4,7 @@ class Vsourz_Imagegallery_Model_Categoryval extends Mage_Core_Model_Abstract{
4
  $catVal = Mage::getModel('imagegallery/imagecategory')->getCollection();
5
  $data = $catVal->getData();
6
  $dropVal = array();
7
- $dropVal[' '] = "Please Select";
8
  foreach($data as $value){
9
  $dropVal[$value['imagecategory_id']] = $value['category_title'];
10
  };
4
  $catVal = Mage::getModel('imagegallery/imagecategory')->getCollection();
5
  $data = $catVal->getData();
6
  $dropVal = array();
7
+ $dropVal[''] = "Please Select";
8
  foreach($data as $value){
9
  $dropVal[$value['imagecategory_id']] = $value['category_title'];
10
  };
app/code/community/Vsourz/Imagegallery/Model/Order.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Vsourz_Imagegallery_Model_Order
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array('value' => 'Ascending', 'label' => 'Ascending'),
8
+ array('value' => 'Descending', 'label' => 'Descending'),
9
+ array('value' => 'Custom', 'label' => 'Custom')
10
+ );
11
+ }
12
+ }
app/code/community/Vsourz/Imagegallery/controllers/Adminhtml/CategoryController.php CHANGED
@@ -35,13 +35,13 @@ class Vsourz_Imagegallery_Adminhtml_CategoryController extends Mage_Adminhtml_Co
35
  $uploader->setAllowRenameFiles(false);
36
  // setAllowRenameFiles(true) -> move your file in a folder the magento way
37
  $uploader->setFilesDispersion(false);
38
- $path = Mage::getBaseDir('media') . DS .'imagegallery';
39
  $imgName = explode('.',$_FILES['category_img']['name']);
40
  $imgName[0] = $imgName[0].'-'.'category_img'.'-'.date('Y-m-d H-i-s');
41
  $imgName = implode('.',$imgName);
42
  $imgName = preg_replace('/\s+/', '-', $imgName);
43
  $uploader->save($path, $imgName);
44
- $data['category_img'] = 'imagegallery'.DS.$imgName;
45
  }catch(Exception $e){
46
 
47
  }
@@ -50,7 +50,7 @@ class Vsourz_Imagegallery_Adminhtml_CategoryController extends Mage_Adminhtml_Co
50
  if(isset($data['category_img']) && $data['category_img']['delete'] == 1){
51
  // delete image file
52
  $image = explode(',',$data['category_img']);
53
- unlink(Mage::getBaseDir('media').DS.$image[1]);
54
  // set db blank entry
55
  $data['category_img'] = '';
56
  }else{
@@ -121,7 +121,7 @@ class Vsourz_Imagegallery_Adminhtml_CategoryController extends Mage_Adminhtml_Co
121
  $id = $this->getRequest()->getParam('id');
122
  $objModel = $model->load($id);
123
  $path = Mage::getBaseDir('media');
124
- unlink($path.DS.$objModel->categoryImg);
125
  $objModel->setId($id)->delete();
126
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
127
  $this->_redirect('*/*/');
@@ -144,7 +144,7 @@ class Vsourz_Imagegallery_Adminhtml_CategoryController extends Mage_Adminhtml_Co
144
  foreach($ids as $id){
145
  $objModel = $imageModel->load($id);
146
  $path = Mage::getBaseDir('media');
147
- unlink($path.DS.$objModel->categoryImg);
148
  $objModel->delete();
149
  }
150
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('imagegallery')->__('Total of %d record(s) were deleted.', count($ids)));
35
  $uploader->setAllowRenameFiles(false);
36
  // setAllowRenameFiles(true) -> move your file in a folder the magento way
37
  $uploader->setFilesDispersion(false);
38
+ $path = Mage::getBaseDir('media').'/'.'imagegallery';
39
  $imgName = explode('.',$_FILES['category_img']['name']);
40
  $imgName[0] = $imgName[0].'-'.'category_img'.'-'.date('Y-m-d H-i-s');
41
  $imgName = implode('.',$imgName);
42
  $imgName = preg_replace('/\s+/', '-', $imgName);
43
  $uploader->save($path, $imgName);
44
+ $data['category_img'] = 'imagegallery/'.$imgName;
45
  }catch(Exception $e){
46
 
47
  }
50
  if(isset($data['category_img']) && $data['category_img']['delete'] == 1){
51
  // delete image file
52
  $image = explode(',',$data['category_img']);
53
+ unlink(Mage::getBaseDir('media').'/'.$image[1]);
54
  // set db blank entry
55
  $data['category_img'] = '';
56
  }else{
121
  $id = $this->getRequest()->getParam('id');
122
  $objModel = $model->load($id);
123
  $path = Mage::getBaseDir('media');
124
+ unlink($path.'/'.$objModel->categoryImg);
125
  $objModel->setId($id)->delete();
126
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
127
  $this->_redirect('*/*/');
144
  foreach($ids as $id){
145
  $objModel = $imageModel->load($id);
146
  $path = Mage::getBaseDir('media');
147
+ unlink($path.'/'.$objModel->categoryImg);
148
  $objModel->delete();
149
  }
150
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('imagegallery')->__('Total of %d record(s) were deleted.', count($ids)));
app/code/community/Vsourz/Imagegallery/controllers/Adminhtml/ImageController.php CHANGED
@@ -35,13 +35,13 @@ class Vsourz_Imagegallery_Adminhtml_ImageController extends Mage_Adminhtml_Contr
35
  $uploader->setAllowRenameFiles(false);
36
  // setAllowRenameFiles(true) -> move your file in a folder the magento way
37
  $uploader->setFilesDispersion(false);
38
- $path = Mage::getBaseDir('media'). DS .'imagegallery' .DS;
39
  $imgName = explode('.',$_FILES['gallery_img']['name']);
40
  $imgName[0] = $imgName[0].'-'.'gallery-img'.'-'.date('Y-m-d H-i-s');
41
  $imgName = implode('.',$imgName);
42
  $imgName = preg_replace('/\s+/', '-', $imgName);
43
  $uploader->save($path, $imgName);
44
- $data['gallery_img'] = 'imagegallery'.DS.$imgName;
45
  }catch(Exception $e){
46
 
47
  }
@@ -50,7 +50,7 @@ class Vsourz_Imagegallery_Adminhtml_ImageController extends Mage_Adminhtml_Contr
50
  if(isset($data['gallery_img']) && $data['gallery_img']['delete'] == 1){
51
  // delete image file
52
  $image = explode(',',$data['gallery_img']);
53
- $img = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA). DS .$image[1] .DS;
54
  if(file_exists($img)){
55
  unlink($img);
56
  }
@@ -122,7 +122,7 @@ class Vsourz_Imagegallery_Adminhtml_ImageController extends Mage_Adminhtml_Contr
122
  $id = $this->getRequest()->getParam('id');
123
  $objModel = $model->load($id);
124
  $path = Mage::getBaseDir('media');
125
- unlink($path.DS.$objModel->galleryImg);
126
  $model->setId($id)->delete();
127
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
128
  $this->_redirect('*/*/');
@@ -144,7 +144,7 @@ class Vsourz_Imagegallery_Adminhtml_ImageController extends Mage_Adminhtml_Contr
144
  foreach($ids as $id){
145
  $objModel = $imageModel->load($id);
146
  $path = Mage::getBaseDir('media');
147
- unlink($path.DS.$objModel->galleryImg);
148
  $objModel->delete();
149
  }
150
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('imagegallery')->__('Total of %d record(s) were deleted.', count($ids)));
35
  $uploader->setAllowRenameFiles(false);
36
  // setAllowRenameFiles(true) -> move your file in a folder the magento way
37
  $uploader->setFilesDispersion(false);
38
+ $path = Mage::getBaseDir('media').'/imagegallery/';
39
  $imgName = explode('.',$_FILES['gallery_img']['name']);
40
  $imgName[0] = $imgName[0].'-'.'gallery-img'.'-'.date('Y-m-d H-i-s');
41
  $imgName = implode('.',$imgName);
42
  $imgName = preg_replace('/\s+/', '-', $imgName);
43
  $uploader->save($path, $imgName);
44
+ $data['gallery_img'] = 'imagegallery/'.$imgName;
45
  }catch(Exception $e){
46
 
47
  }
50
  if(isset($data['gallery_img']) && $data['gallery_img']['delete'] == 1){
51
  // delete image file
52
  $image = explode(',',$data['gallery_img']);
53
+ $img = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA).'/'.$image[1];
54
  if(file_exists($img)){
55
  unlink($img);
56
  }
122
  $id = $this->getRequest()->getParam('id');
123
  $objModel = $model->load($id);
124
  $path = Mage::getBaseDir('media');
125
+ unlink($path.'/'.$objModel->galleryImg);
126
  $model->setId($id)->delete();
127
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
128
  $this->_redirect('*/*/');
144
  foreach($ids as $id){
145
  $objModel = $imageModel->load($id);
146
  $path = Mage::getBaseDir('media');
147
+ unlink($path.'/'.$objModel->galleryImg);
148
  $objModel->delete();
149
  }
150
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('imagegallery')->__('Total of %d record(s) were deleted.', count($ids)));
app/code/community/Vsourz/Imagegallery/etc/config.xml CHANGED
@@ -92,4 +92,12 @@
92
  </imagegallery_read>
93
  </resources>
94
  </global>
 
 
 
 
 
 
 
 
95
  </config>
92
  </imagegallery_read>
93
  </resources>
94
  </global>
95
+ <default>
96
+ <imagegallery>
97
+ <settings>
98
+ <loadjs>0</loadjs>
99
+ <imageloaded>0</imageloaded>
100
+ </settings>
101
+ </imagegallery>
102
+ </default>
103
  </config>
app/code/community/Vsourz/Imagegallery/etc/system.xml CHANGED
@@ -38,12 +38,22 @@
38
  <label>Select Order</label>
39
  <comment><![CDATA[Select the Sorting Order of the images in the gallery ]]></comment>
40
  <frontend_type>select</frontend_type>
41
- <source_model>imagegallery/source_order</source_model>
42
  <sort_order>20</sort_order>
43
  <show_in_default>1</show_in_default>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  </order>
 
 
 
 
 
 
 
 
 
 
47
  </fields>
48
  </settings>
49
  </groups>
38
  <label>Select Order</label>
39
  <comment><![CDATA[Select the Sorting Order of the images in the gallery ]]></comment>
40
  <frontend_type>select</frontend_type>
41
+ <source_model>imagegallery/order</source_model>
42
  <sort_order>20</sort_order>
43
  <show_in_default>1</show_in_default>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  </order>
47
+ <imageloaded translate="label">
48
+ <label>Load Imagesloaded Library</label>
49
+ <comment><![CDATA[Select YES if Imagesloaded library in not included in your Magento Project]]></comment>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>adminhtml/system_config_source_yesno</source_model>
52
+ <sort_order>30</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </imageloaded>
57
  </fields>
58
  </settings>
59
  </groups>
app/code/community/Vsourz/Imagegallery/sql/imagegallery_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $resource = Mage::getResourceModel('imagegallery/imagedetail_collection');
7
+ if(!method_exists($resource, 'getEntity')){
8
+
9
+ $table = $this->getTable('imagedetail');
10
+ $query = 'ALTER TABLE `' . $table . '` ADD COLUMN `position` INTEGER NOT NULL DEFAULT 0 AFTER `category_id`';
11
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
12
+ try {
13
+ $connection->query($query);
14
+ } catch (Exception $e) {
15
+
16
+ }
17
+ }
18
+
19
+ $installer->endSetup();
20
+ ?>
app/design/frontend/base/default/layout/imagegallery.xml CHANGED
@@ -3,9 +3,9 @@
3
  <default>
4
  <reference name="head">
5
  <action method="addItem" ifconfig="imagegallery/settings/loadjs"><type>skin_js</type><name>js/imagegallery/jquery-1.10.2.min.js</name></action>
6
- <action method="addItem"><type>skin_js</type><name>js/imagegallery/masonry.min.js</name></action>
 
7
  <action method="addItem"><type>skin_js</type><name>js/imagegallery/jquery.magnific-popup.min.js</name></action>
8
- <action method="addItem"><type>skin_js</type><name>js/imagegallery/magnific-popup.js</name></action>
9
  <action method="addItem"><type>skin_css</type><name>css/imagegallery/imagegallery.css</name></action>
10
  <action method="addItem"><type>skin_css</type><name>css/imagegallery/magnific-popup.css</name></action>
11
  </reference>
3
  <default>
4
  <reference name="head">
5
  <action method="addItem" ifconfig="imagegallery/settings/loadjs"><type>skin_js</type><name>js/imagegallery/jquery-1.10.2.min.js</name></action>
6
+ <action method="addItem" ifconfig="imagegallery/settings/imageloaded"><type>skin_js</type><name>js/imagegallery/imagesloaded.js</name></action>
7
+ <action method="addItem"><type>skin_js</type><name>js/imagegallery/masonry.min.js</name></action>
8
  <action method="addItem"><type>skin_js</type><name>js/imagegallery/jquery.magnific-popup.min.js</name></action>
 
9
  <action method="addItem"><type>skin_css</type><name>css/imagegallery/imagegallery.css</name></action>
10
  <action method="addItem"><type>skin_css</type><name>css/imagegallery/magnific-popup.css</name></action>
11
  </reference>
app/design/frontend/base/default/template/imagegallery/imagegallery.phtml CHANGED
@@ -1,91 +1,128 @@
1
- <?php
2
  $collection = $this->getImages();
3
  $imageData = $collection->getData();
4
-
5
  $catCollection = $this->getCategoryData();
6
  $catData = $catCollection->getData();
7
-
8
  ?>
9
  <div class="image-gallery-outer">
10
- <div class="category-desc">
11
- <?php foreach($catData as $key => $value)
12
- {
13
- ?>
14
- <div class="title">
15
- <h3><?php echo $value['category_title']?></h3>
16
- </div>
17
-
18
- <?php if($value['category_img']): ?>
19
- <div class="cat-img">
20
- <img src="<?php echo Mage::getBaseUrl('media').$value['category_img'] ?>" title="<?php echo $value['category_title'] ?>" alt="<?php echo $value['category_title'] ?>"/>
21
  </div>
22
- <?php //echo Mage::getBaseUrl('media'); ?>
23
- <?php endif; ?>
24
-
25
- <?php if($value['category_description']): ?>
26
- <div class="cat-desc"><?php echo $value['category_description'] ?></div>
27
  <?php endif; ?>
28
- <?php
29
- }
30
- ?>
31
- </div>
 
 
 
 
 
 
32
 
33
- <div class="image-detail">
34
- <ul id="masonry-loop" class="image-gallery">
35
- <?php foreach($imageData as $data){ ?>
36
- <?php //print_r($data); ?>
37
- <li class="gallery-item masonry-entry">
38
- <div class="img-box">
39
- <div class="img-box-inner">
40
- <a class="imagegallery" href="<?php echo Mage::getBaseUrl('media').$data['gallery_img']; ?>" title="<?php echo $data['image_title'] ?>"><img src="<?php echo Mage::getBaseUrl('media').$data['gallery_img']; ?>" alt="<?php echo $data['image_title'] ?>"/></a>
41
- <div class="gallery-desc-box">
42
- <div class="gallery-content">
43
- <h3 class="gallery-title">
44
- <a class="imagetitle" href="<?php echo Mage::getBaseUrl('media').$data['gallery_img']; ?>" title="<?php echo $data['image_title'] ?>"><?php echo $data['image_title'] ?></a>
45
- </h3>
46
-
47
- <?php if($data['image_description']): ?>
48
- <div class="gallery-desc">
49
- <?php echo $data['image_description'] ?>
 
 
 
 
 
 
 
50
  </div>
51
- <?php endif; ?>
52
- <a class="image-link gallery-block " data-effect="mfp-move-horizontal" href="<?php echo Mage::getBaseUrl('media').$data['gallery_img']; ?>" title="<?php echo $data['image_title'] ?>"><?php echo $data['image_title'] ?>
53
- <i class="fa"></i>
54
- </a>
55
- </div>
56
-
57
- </div>
58
-
59
-
60
- </div>
61
- </div>
62
- </li>
63
- <?php } ?>
64
- </ul>
65
- </div>
66
  <script type="text/javascript">
67
- jQuery(document).ready(function(){
 
 
 
 
 
 
 
 
 
 
 
 
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  var $container = jQuery('#masonry-loop');
70
  var number;
71
  // initialize Isotope
72
  if($container.width() < 5000 && $container.width()>900){
73
- number=3;
74
  }
75
  if($container.width() > 460 && $container.width() < 900){
76
- number=2;
77
  }
78
  if($container.width() < 460){
79
- number=1;
80
  }
81
-
82
-
83
- var container1 = document.querySelector('#masonry-loop');
84
  //create empty var msnry
85
  var msnry;
86
  // initialize Masonry after all images have loaded
87
- imagesLoaded( container1, function() {
88
- msnry = new Masonry( container1, {
89
  itemSelector:'.masonry-entry',
90
  "gutter": 0,
91
  "width":$container.width()/number
@@ -93,5 +130,4 @@ $catData = $catCollection->getData();
93
  });
94
  });
95
  </script>
96
- </div>
97
-
1
+ <?php
2
  $collection = $this->getImages();
3
  $imageData = $collection->getData();
 
4
  $catCollection = $this->getCategoryData();
5
  $catData = $catCollection->getData();
6
+ $catid="";
7
  ?>
8
  <div class="image-gallery-outer">
9
+ <div class="category-desc">
10
+ <?php foreach($catData as $key => $value)
11
+ {
12
+ $catid=$value['imagecategory_id'];
13
+ ?>
14
+ <div class="title">
15
+ <h3><?php echo $value['category_title']; ?></h3>
 
 
 
 
16
  </div>
17
+ <?php if($value['category_img']): ?>
18
+ <div class="cat-img">
19
+ <img src="<?php echo Mage::getBaseUrl('media').$value['category_img']; ?>" title="<?php echo $value['category_title']; ?>" alt="<?php echo $value['category_title']; ?>"/>
20
+ </div>
21
+ <?php //echo Mage::getBaseUrl('media'); ?>
22
  <?php endif; ?>
23
+
24
+ <?php if($value['category_description']): ?>
25
+ <div class="cat-desc">
26
+ <?php echo $value['category_description']; ?>
27
+ </div><?php
28
+ endif;
29
+ ?><?php
30
+ }
31
+ ?>
32
+ </div>
33
 
34
+ <div class="image-detail">
35
+ <ul id="masonry-loop" class="image-gallery">
36
+ <?php foreach($imageData as $data): ?>
37
+ <?php //print_r($data); ?>
38
+ <li class="gallery-item masonry-entry">
39
+ <div class="img-box">
40
+ <div class="img-box-inner">
41
+ <a class="imagegallery" href="<?php echo Mage::getBaseUrl('media').$data['gallery_img']; ?>" title="<?php echo $data['image_title']; ?>"><img src="<?php echo Mage::getBaseUrl('media').$data['gallery_img']; ?>" alt="<?php echo $data['image_title']; ?>"/></a>
42
+ <div class="gallery-desc-box">
43
+ <div class="gallery-content">
44
+ <h3 class="gallery-title">
45
+ <?php echo $data['image_title']; ?>
46
+ </h3>
47
+ <?php if($data['image_description']): ?>
48
+ <div class="gallery-desc">
49
+ <?php echo $data['image_description']; ?>
50
+ </div>
51
+ <?php endif; ?>
52
+ <a class="image-link gallery-block image-link<?php echo $catid; ?>" data-effect="mfp-move-horizontal" href="<?php echo Mage::getBaseUrl('media').$data['gallery_img']; ?>" title="<?php echo $data['image_title']; ?>"><?php echo $data['image_title']; ?>
53
+ <i class="fa"></i>
54
+ </a>
55
+ </div>
56
+ </div>
57
+ </div>
58
  </div>
59
+ </li>
60
+ <?php endforeach; ?>
61
+ </ul>
62
+ </div>
 
 
 
 
 
 
 
 
 
 
 
63
  <script type="text/javascript">
64
+ jQuery(function($) {
65
+ // Gallery
66
+ jQuery('.image-link<?php echo $catid; ?>.gallery-block').magnificPopup({
67
+ type: 'image',
68
+ gallery:{
69
+ enabled:true,
70
+ preload: function(e){
71
+ var interval,
72
+ hasSize,
73
+ onHasSize = function() {
74
+ if(hasSize) return;
75
+ // we ignore browsers that don't support naturalWidth
76
+ var naturalWidth = img[0].naturalWidth;
77
 
78
+ if(window.devicePixelRatio > 1 && naturalWidth > 0) {
79
+ img.css('max-width', naturalWidth / window.devicePixelRatio);
80
+ }
81
+ clearInterval(interval);
82
+ hasSize = true;
83
+ },
84
+ onLoaded = function() {
85
+ onHasSize();
86
+ },
87
+ onError = function() {
88
+ onHasSize();
89
+ },
90
+ checkSize = function() {
91
+ if(img[0].naturalWidth > 0) {
92
+ onHasSize();
93
+ }
94
+ },
95
+ img = $('<img />')
96
+ .on('load', onLoaded)
97
+ .on('error', onError)
98
+ // hd-image.jpg is optimized for the current pixel density
99
+ .attr('src', 'hd-image.jpg')
100
+ .appendTo(someContainer);
101
+ interval = setInterval(checkSize, 100);
102
+ checkSize();
103
+ }
104
+ }
105
+ });
106
+ });
107
+ jQuery(document).ready(function(){
108
  var $container = jQuery('#masonry-loop');
109
  var number;
110
  // initialize Isotope
111
  if($container.width() < 5000 && $container.width()>900){
112
+ number=3;
113
  }
114
  if($container.width() > 460 && $container.width() < 900){
115
+ number=2;
116
  }
117
  if($container.width() < 460){
118
+ number=1;
119
  }
120
+ var container1 = document.querySelector('#masonry-loop');
 
 
121
  //create empty var msnry
122
  var msnry;
123
  // initialize Masonry after all images have loaded
124
+ imagesLoaded( container1, function(){
125
+ msnry = new Masonry( container1,{
126
  itemSelector:'.masonry-entry',
127
  "gutter": 0,
128
  "width":$container.width()/number
130
  });
131
  });
132
  </script>
133
+ </div>
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Masonry_Responsive_Image_Gallery</name>
4
- <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/MIT">Massachusetts Institute of Technology License (MITL)</license>
7
  <channel>community</channel>
@@ -24,13 +24,12 @@ Features:&#xD;
24
  - Facility to add Image title and Description&#xD;
25
  - Smooth Pop Up navigation&#xD;
26
  - Responsive Layout</description>
27
- <notes>&gt;&gt; Added Image sorting functinality&#xD;
28
- &gt;&gt; Installed default category script&#xD;
29
- </notes>
30
  <authors><author><name>Vsourz Digital</name><user>MAG002979323</user><email>mehul@vsourz.com</email></author></authors>
31
- <date>2015-07-11</date>
32
- <time>06:42:56</time>
33
- <contents><target name="magecommunity"><dir name="Vsourz"><dir name="Imagegallery"><dir name="Block"><dir name="Adminhtml"><dir name="Category"><dir name="Edit"><file name="Form.php" hash="4dfc98b8d47de92168dd2af4d1ceb59b"/><dir name="Tabs"><file name="Form.php" hash="c7ec795ca7e26f34898d794ddab5513f"/></dir><file name="Tabs.php" hash="6a0d5f077e39b8da735e7c5e5ec412ae"/></dir><file name="Edit.php" hash="4a1cff2d7aabeddd48417491552a0974"/><file name="Grid.php" hash="b8adc8bea02ff87630f721f20dbc888e"/></dir><file name="Category.php" hash="5e709564bb49ff528a282d0ff28c36f4"/><dir name="Image"><dir name="Edit"><file name="Form.php" hash="109e6649791fcc746e9cb8569d899ecb"/><dir name="Tabs"><file name="Form.php" hash="fb9bf0614134f89f26b8966ad0051ba4"/></dir><file name="Tabs.php" hash="5f800ef86474a8d442da93dcdfe06fc9"/></dir><file name="Edit.php" hash="c2aa1247ff8d3810131348b3052d149a"/><file name="Grid.php" hash="b0fda67c796983662e66433efcb4cea7"/></dir><file name="Image.php" hash="a58193e203d2a574ebe9098a69b58ac8"/><dir name="Imagegallery"><dir name="Renderer"><file name="Category.php" hash="86675087f8583258fd68922e4889f057"/><file name="Catimage.php" hash="5e155696e6d55c8d32cc9a796a1c5185"/><file name="Image.php" hash="bc48bfe317aee82375bdb2855b0a3b2b"/><file name="Status.php" hash="cfd1dd4c0bdb8d79df9430a46f6ca286"/></dir></dir></dir><file name="Imagegallery.php" hash="95efc6cc4d5c03d1530846a87a4bbd46"/></dir><dir name="Helper"><file name="Data.php" hash="fabe8e0acec8db8cef0737ccd284d97e"/></dir><dir name="Model"><file name="Categoryval.php" hash="ca55f6d92fb6c46144f329d960870449"/><file name="Imagecategory.php" hash="bd794d0c94dc1c6c819931021a8612aa"/><file name="Imagedetail.php" hash="91eb4f3055da08011d05696968f470aa"/><file name="Imagegallery.php" hash="0bc0542454f5f4d1d115ad45637ff8e0"/><dir name="Resource"><dir name="Imagecategory"><file name="Collection.php" hash="c64ccf034d71a7544ad8431a5b39ea85"/></dir><file name="Imagecategory.php" hash="e99769496f95cb1c148b5e4528146f6f"/><dir name="Imagedetail"><file name="Collection.php" hash="d5720222b3d79fc8b2396b0d563ad656"/></dir><file name="Imagedetail.php" hash="990f3a47b3c2fb70a29a2cffa04b4613"/></dir><dir name="Source"><file name="Order.php" hash="10dad964da7e8ef86439dd66014d9647"/><file name="Transition.php" hash="eefe7e92beb9be01d6564b5dc048200e"/><file name="Truefalse.php" hash="8aec1bd8bc378da1ed624f81cb9657e5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CategoryController.php" hash="54302dd7a3cc2cf99677b59f3c9425ad"/><file name="ImageController.php" hash="62853f39c3ac5fd19bad716bfc14a876"/></dir></dir><dir name="data"><dir name="imagegallery_setup"><file name="data-install-0.1.0.php" hash="fef0474ae9dc1efca5fd5b3c2f50192b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d9a665a5fb368bdcdfdc7702e892c2b0"/><file name="config.xml" hash="d0b134304fb1796620571e8375e3d4f8"/><file name="system.xml" hash="45203369ab36df3794fe4ee46e8b16ca"/></dir><dir name="sql"><dir name="imagegallery_setup"><file name="mysql4-install-0.1.0.php" hash="35b6ce01a7d8254f945bd3bbf0ec5878"/><file name="upgrade-0.1.0-0.1.1.php" hash="645ec776b6b7a193e7d0c5826e5ee0f5"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="imagegallery"><file name="imagegallery.phtml" hash="f1033b43c02b89e0b7c1253504e99c40"/></dir></dir><dir name="layout"><file name="imagegallery.xml" hash="064e64706da5130e728aebb40dcdcb86"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="imagegallery.xml" hash="97c384487e782254d0eeace392ed44cf"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Vsourz_Imagegallery.xml" hash="de046c38ddfb211dad16aa97cfc07dba"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="imagegallery"><file name="imagegallery.css" hash="e37592d71790cb2f1836b84ec9cbf138"/><file name="magnific-popup.css" hash="d1519c5da7334e8f04da554e25c9f5ca"/></dir></dir><dir name="images"><dir name="imagegallery"><file name="left-arrow.png" hash="bc1dd5ff9a0e49498ecb0dc21324627a"/><file name="right-arrow.png" hash="ae1e4d0566dbbbc1de1dd2ef1820747c"/><file name="view-image.png" hash="3624d70806879558f0fcba126cfc35a5"/></dir></dir><dir name="js"><dir name="imagegallery"><file name="jquery-1.10.2.min.js" hash="628072e7212db1e8cdacb22b21752cda"/><file name="jquery.magnific-popup.min.js" hash="d9267d6dda814fd767e1df7bfbe7eb57"/><file name="magnific-popup.js" hash="81af8a0075df9127fce325ba31c03445"/><file name="masonry.min.js" hash="7055b53b3da0bedce27f793a9909472b"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="imagegallery"><file name="favicon.ico" hash="88733ee53676a47fc354a61c32516e82"/></dir></target></contents>
34
  <compatible/>
35
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
36
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Masonry_Responsive_Image_Gallery</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/MIT">Massachusetts Institute of Technology License (MITL)</license>
7
  <channel>community</channel>
24
  - Facility to add Image title and Description&#xD;
25
  - Smooth Pop Up navigation&#xD;
26
  - Responsive Layout</description>
27
+ <notes>&gt;&gt; Resolved directory path issue&#xD;
28
+ &gt;&gt; Images loader JS</notes>
 
29
  <authors><author><name>Vsourz Digital</name><user>MAG002979323</user><email>mehul@vsourz.com</email></author></authors>
30
+ <date>2015-09-08</date>
31
+ <time>09:51:02</time>
32
+ <contents><target name="magecommunity"><dir name="Vsourz"><dir name="Imagegallery"><dir name="Block"><dir name="Adminhtml"><dir name="Category"><dir name="Edit"><file name="Form.php" hash="4dfc98b8d47de92168dd2af4d1ceb59b"/><dir name="Tabs"><file name="Form.php" hash="c7ec795ca7e26f34898d794ddab5513f"/></dir><file name="Tabs.php" hash="6a0d5f077e39b8da735e7c5e5ec412ae"/></dir><file name="Edit.php" hash="4a1cff2d7aabeddd48417491552a0974"/><file name="Grid.php" hash="b8adc8bea02ff87630f721f20dbc888e"/></dir><file name="Category.php" hash="5e709564bb49ff528a282d0ff28c36f4"/><dir name="Image"><dir name="Edit"><file name="Form.php" hash="109e6649791fcc746e9cb8569d899ecb"/><dir name="Tabs"><file name="Form.php" hash="fb9bf0614134f89f26b8966ad0051ba4"/></dir><file name="Tabs.php" hash="5f800ef86474a8d442da93dcdfe06fc9"/></dir><file name="Edit.php" hash="c2aa1247ff8d3810131348b3052d149a"/><file name="Grid.php" hash="b0fda67c796983662e66433efcb4cea7"/></dir><file name="Image.php" hash="a58193e203d2a574ebe9098a69b58ac8"/><dir name="Imagegallery"><dir name="Renderer"><file name="Category.php" hash="86675087f8583258fd68922e4889f057"/><file name="Catimage.php" hash="6139e7fb77105fd9856cdff347fc4dcd"/><file name="Image.php" hash="889f3343bafa94a000323f3eaedae547"/><file name="Status.php" hash="cfd1dd4c0bdb8d79df9430a46f6ca286"/></dir></dir></dir><file name="Imagegallery.php" hash="95efc6cc4d5c03d1530846a87a4bbd46"/></dir><dir name="Helper"><file name="Data.php" hash="fabe8e0acec8db8cef0737ccd284d97e"/></dir><dir name="Model"><file name="Categoryval.php" hash="958b968376df12e6a167c75fba3c607a"/><file name="Imagecategory.php" hash="bd794d0c94dc1c6c819931021a8612aa"/><file name="Imagedetail.php" hash="91eb4f3055da08011d05696968f470aa"/><file name="Imagegallery.php" hash="0bc0542454f5f4d1d115ad45637ff8e0"/><file name="Order.php" hash="270fa97d9abe3aa591940ef3e56d3578"/><dir name="Resource"><dir name="Imagecategory"><file name="Collection.php" hash="c64ccf034d71a7544ad8431a5b39ea85"/></dir><file name="Imagecategory.php" hash="e99769496f95cb1c148b5e4528146f6f"/><dir name="Imagedetail"><file name="Collection.php" hash="d5720222b3d79fc8b2396b0d563ad656"/></dir><file name="Imagedetail.php" hash="990f3a47b3c2fb70a29a2cffa04b4613"/></dir><dir name="Source"><file name="Order.php" hash="10dad964da7e8ef86439dd66014d9647"/><file name="Transition.php" hash="eefe7e92beb9be01d6564b5dc048200e"/><file name="Truefalse.php" hash="8aec1bd8bc378da1ed624f81cb9657e5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CategoryController.php" hash="c955bfe3c9d14cf09d5f895f8ea32a1b"/><file name="ImageController.php" hash="f67121b61c567005bb09cb8020dea587"/></dir></dir><dir name="data"><dir name="imagegallery_setup"><file name="data-install-0.1.0.php" hash="fef0474ae9dc1efca5fd5b3c2f50192b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d9a665a5fb368bdcdfdc7702e892c2b0"/><file name="config.xml" hash="ae46b699f0b923fa44c8189d5a7ab723"/><file name="system.xml" hash="59aeecdb8d31c3c185a1bcdd2d8d1f0b"/></dir><dir name="sql"><dir name="imagegallery_setup"><file name="mysql4-install-0.1.0.php" hash="35b6ce01a7d8254f945bd3bbf0ec5878"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="179bcecd27d53c89d1ba1c79a4a7b500"/><file name="upgrade-0.1.0-0.1.1.php" hash="645ec776b6b7a193e7d0c5826e5ee0f5"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="imagegallery"><file name="imagegallery.phtml" hash="459670b1ff4ed4a0511fc1401319d566"/></dir></dir><dir name="layout"><file name="imagegallery.xml" hash="6bdfb5b2e307eb755c6369778a00c80f"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="imagegallery.xml" hash="97c384487e782254d0eeace392ed44cf"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Vsourz_Imagegallery.xml" hash="de046c38ddfb211dad16aa97cfc07dba"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="imagegallery"><file name="imagegallery.css" hash="a3744be6046e5e717da7f191edc3626e"/><file name="magnific-popup.css" hash="d1519c5da7334e8f04da554e25c9f5ca"/></dir></dir><dir name="images"><dir name="imagegallery"><file name="left-arrow.png" hash="bc1dd5ff9a0e49498ecb0dc21324627a"/><file name="right-arrow.png" hash="ae1e4d0566dbbbc1de1dd2ef1820747c"/><file name="view-image.png" hash="3624d70806879558f0fcba126cfc35a5"/></dir></dir><dir name="js"><dir name="imagegallery"><file name="imagesloaded.js" hash="f70def9bddf45be549ec0575645b8038"/><file name="jquery-1.10.2.min.js" hash="628072e7212db1e8cdacb22b21752cda"/><file name="jquery.magnific-popup.min.js" hash="d9267d6dda814fd767e1df7bfbe7eb57"/><file name="magnific-popup.js" hash="3ae4a7e1b649f955877450388b84c5ef"/><file name="masonry.min.js" hash="7055b53b3da0bedce27f793a9909472b"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="imagegallery"><file name="favicon.ico" hash="88733ee53676a47fc354a61c32516e82"/></dir></target></contents>
33
  <compatible/>
34
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
35
  </package>
skin/frontend/base/default/css/imagegallery/imagegallery.css CHANGED
@@ -11,7 +11,7 @@ box-sizing:border-box;
11
  .category-desc {padding:0 0 15px 0;}
12
  .cat-img {padding:0 0 15px 0;}
13
  .cat-img img{width:100%;}
14
- .image-gallery{overflow:hidden;padding:0;background:#FFF;margin:0 -15px;}
15
  .gallery-item{
16
  float:left;
17
  width:33.33%;
11
  .category-desc {padding:0 0 15px 0;}
12
  .cat-img {padding:0 0 15px 0;}
13
  .cat-img img{width:100%;}
14
+ .image-gallery{overflow:hidden;padding:0;background:#FFF;margin:0 -10px;}
15
  .gallery-item{
16
  float:left;
17
  width:33.33%;
skin/frontend/base/default/js/imagegallery/imagesloaded.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*!
2
+ * imagesLoaded PACKAGED v3.1.4
3
+ * JavaScript is all like "You images are done yet or what?"
4
+ * MIT License
5
+ */
6
+
7
+ (function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("eventEmitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(this,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function c(e){this.img=e}function f(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);for(var i=n.querySelectorAll("img"),r=0,o=i.length;o>r;r++){var s=i[r];this.addImage(s)}}},s.prototype.addImage=function(e){var t=new c(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),c.prototype=new t,c.prototype.check=function(){var e=v[this.img.src]||new f(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},c.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return f.prototype=new t,f.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},f.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},f.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},f.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},f.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},f.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s});
skin/frontend/base/default/js/imagegallery/magnific-popup.js CHANGED
@@ -1,71 +1 @@
1
  // Initialize popup as usual
2
- jQuery(function($) {
3
- // Popup image
4
- $('.image-link').magnificPopup({
5
- type: 'image'
6
- });
7
-
8
- // Gallery
9
- jQuery('.image-link.gallery-block').magnificPopup({
10
- type: 'image',
11
- gallery:{
12
- enabled:true,
13
- preload: function(e){
14
- var interval,
15
- hasSize,
16
- onHasSize = function() {
17
- if(hasSize) return;
18
-
19
- // we ignore browsers that don't support naturalWidth
20
- var naturalWidth = img[0].naturalWidth;
21
-
22
- if(window.devicePixelRatio > 1 && naturalWidth > 0) {
23
- img.css('max-width', naturalWidth / window.devicePixelRatio);
24
- }
25
-
26
- clearInterval(interval);
27
- hasSize = true;
28
- },
29
- onLoaded = function() {
30
- onHasSize();
31
- },
32
- onError = function() {
33
- onHasSize();
34
- },
35
- checkSize = function() {
36
- if(img[0].naturalWidth > 0) {
37
- onHasSize();
38
- }
39
- },
40
- img = $('<img />')
41
- .on('load', onLoaded)
42
- .on('error', onError)
43
- // hd-image.jpg is optimized for the current pixel density
44
- .attr('src', 'hd-image.jpg')
45
- .appendTo(someContainer);
46
-
47
- interval = setInterval(checkSize, 100);
48
- checkSize();
49
- }
50
-
51
- }
52
-
53
- });
54
-
55
- // Zoom popup
56
- $('.image-link.zoom').magnificPopup({
57
- type: 'image',
58
- mainClass: 'mfp-with-zoom', // this class is for CSS animation below
59
- zoom: {
60
- enabled: true, // By default it's false, so don't forget to enable it
61
- duration: 300, // duration of the effect, in milliseconds
62
- easing: 'ease-in-out', // CSS transition easing function
63
- opener: function(openerElement) {
64
- return openerElement.is('img') ? openerElement : openerElement.find('img');
65
- }
66
- }
67
- });
68
-
69
-
70
-
71
- });
1
  // Initialize popup as usual