Skip to content
Matt Zimmermann edited this page Apr 1, 2015 · 2 revisions

../js/plugins.js

Replace:

// ---- Mini-Basket Functions ---- //
	$.fn.isOnScreen=function(){var a=$(window),b=a.scrollTop(),d=a.scrollLeft(),e,c=this.offset();e=d+a.width();a=b+a.height();c.right=c.left+this.outerWidth();c.bottom=c.top+this.outerHeight();return!(e<c.left||d>c.right||a<c.top||b>c.bottom)};
	function MiniBasket(){var a=$("#js-mini-basket, #js-mobile-basket-button, #js-mobile-footer-basket"),b=$("#js-mini-basket-container"),d=$("body");a&&b&&($(a).on("click",function(a){b.addClass("open");0!=d.scrollTop&&$("html, body").animate({scrollTop: '0px'}, 400);a.preventDefault()}),d.on("click","#js-continue-shopping",function(a){a.preventDefault();b.removeClass("open")}),d.on("click",function(){b.hasClass("open")&&b.isOnScreen()&&b.removeClass("open")}),b.removeClass("open"))}var minibasket=new MiniBasket;

With:

// ---- Mini-Basket Functions ---- //
	$.fn.isOnScreen=function(){var a=$(window),b=a.scrollTop(),d=a.scrollLeft(),e,c=this.offset();e=d+a.width();a=b+a.height();c.right=c.left+this.outerWidth();c.bottom=c.top+this.outerHeight();return!(e<c.left||d>c.right||a<c.top||b>c.bottom)};
	function MiniBasket(){var a=$("#js-mini-basket, #js-mobile-basket-button, #js-mobile-footer-basket"),b=$("#js-mini-basket-container"),d=$("body");a&&b&&($(a).on("click",function(a){b.toggleClass("open");0!=d.scrollTop&&$("html, body").animate({scrollTop: '0px'}, 400);a.preventDefault()}),d.on("click","#js-continue-shopping",function(a){a.preventDefault();b.removeClass("open")}),d.on("click",function(){b.hasClass("open")&&b.isOnScreen()&&window.matchMedia&&b.removeClass("open")}),b.removeClass("open"))}var minibasket=new MiniBasket;

../js/scripts.js

Replace:

// ---- Open Product Image Gallery ---- //
productGallery: function (trigger) {
	trigger.on('click', function (e) {
		var startAt = $(this).attr('data-index');
		
		e.preventDefault();
		if (gallery.length > 0) {
			$.magnificPopup.open({
				callbacks: {
					open: function () {
						//$.magnificPopup.instance.goTo(startAt);
					}
				},
				gallery: {
					enabled: true
				},
				items: gallery,
				type: 'image'
			});
		}
		else {
			$.magnificPopup.open({
				items: {
					src: $('#js-main-image').attr('data-image')
				},
				type: 'image'
			});
		};
	});
},

With:

// ---- Open Product Image Gallery ---- //
productGallery: function (trigger) {
	trigger.on('click', function (e) {
		var startAt = Number($(this).attr('data-index'));
		
		e.preventDefault();
		if (gallery.length > 0) {
			$.magnificPopup.open({
				callbacks: {
					open: function () {
						$.magnificPopup.instance.goTo(startAt);
					}
				},
				gallery: {
					enabled: true
				},
				items: gallery,
				type: 'image'
			});
		}
		else {
			$.magnificPopup.open({
				items: {
					src: $('#js-main-image').attr('data-image')
				},
				type: 'image'
			});
		};
	});
},

Replace:

// ---- Open Product Image Gallery ---- //
cornerstoneUX.sharedFunctions.productGallery($('#js-main-image-zoom'));

var thumbnails = document.getElementById('js-thumbnails');

for (var i = 0; i < thumbnails.children.length; i++) {
	(function (index) {
		thumbnails.children[i].onclick = function () {
			document.getElementById('js-main-image-zoom').setAttribute('data-index', index);
		}
	})(i);
};

With:

// ---- Open Product Image Gallery ---- //
cornerstoneUX.sharedFunctions.productGallery($('#js-main-image-zoom'));

var mainImageZoom = $('#js-main-image-zoom'),
	thumbnails = $('#js-thumbnails');
	
thumbnails.on('click', 'div', function () {
	var thumbnailIndex = $(this).attr('data-index');
	mainImageZoom.attr('data-index', thumbnailIndex);
});

Replace:

// ---- Update Display When Attribute Machine Fires ---- //
MivaEvents.SubscribeToEvent('variant_changed', function () {
	gallery.length = 0;
	outOfStock ();
});

With:

// ---- Update Display When Attribute Machine Fires ---- //
MivaEvents.SubscribeToEvent('variant_changed', function () {
	gallery.length = 0;
	mainImageZoom.attr('data-index', 0);
	thumbnailIndex = 0;
	outOfStock ();
});

HEAD Tag

Replace:

<link href="https://fonts.googleapis.com/css?family=Oswald|Source+Sans+Pro:400,600,400italic,700" rel="stylesheet" />

With:

<link href="https://fonts.googleapis.com/css?family=Oswald|Source+Sans+Pro:400,600,400italic,700" rel="stylesheet" data-norem />

"Product Display Layout Image Machine"

Replace:

<mvt:assign name="l.settings:clean:product:name" value="glosub(l.settings:product:name, asciichar(39), '&#39;')" />
<script>
	var gallery = [],
		thumbnailIndex = 0;

	ImageMachine.prototype.ImageMachine_Generate_Thumbnail = function (thumbnail_image, main_image, closeup_image, type_code) {
		var thumbnail,
			img;
	
		thumbnail = document.createElement('div');
		thumbnail.className = 'column one-third medium-one-fourth';
		thumbnail.setAttribute('data-index', thumbnailIndex++);
		
		if (typeof(thumbnail_image) == 'string' && thumbnail_image.length > 0) {
			img = document.createElement('img');
			img.src = thumbnail_image;
			thumbnail.appendChild(img);
			gallery.push({
				src: closeup_image,
				title: '&mvt:clean:product:name;'
			});
		};
		return thumbnail;
	};
</script>

With:

<mvt:assign name="l.settings:clean:product:name" value="glosub(l.settings:product:name, asciichar(39), '&#39;')" />
<script>
	var gallery = [],
		thumbnailIndex = 0;

	ImageMachine.prototype.ImageMachine_Generate_Thumbnail = function (thumbnail_image, main_image, closeup_image, type_code) {
		var thumbnail,
			img;
	
		thumbnail = document.createElement('div');
		thumbnail.className = 'column one-third medium-one-fourth';
		thumbnail.setAttribute('data-index', thumbnailIndex++);
		
		if (typeof(thumbnail_image) == 'string' && thumbnail_image.length > 0) {
			img = document.createElement('img');
			img.src = thumbnail_image;
			thumbnail.appendChild(img);
		};
		gallery.push({
			src: closeup_image,
			title: '&mvt:clean:product:name;'
		});
		return thumbnail;
	};
</script>