Skip to content

Instantly share code, notes, and snippets.

View theStreets93's full-sized avatar

Matej Đaković theStreets93

View GitHub Profile
@theStreets93
theStreets93 / checkout_index_index.xml
Last active April 12, 2017 06:39
Checkout Component's
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Checkout\Block\Onepage" name="checkout.root" template="onepage.phtml" cacheable="false">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
@theStreets93
theStreets93 / APP.js
Created June 10, 2016 12:45
Magento RWD Theme - Delay on Top Navigation
mouseEnterAction: function(event, target) {
if(this.useSmallScreenBehavior()) {
return; // don't do mouse enter functionality on smaller screens
}
window.mytimeout = setTimeout(function(){
$j(target).addClass('menu-active'); //show current menu
}, 300);
},
mouseLeaveAction: function(event, target) {
/*! Picturefill - v2.3.1 - 2015-04-09
* http://scottjehl.github.io/picturefill
* Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */
window.matchMedia||(window.matchMedia=function(){"use strict";var a=window.styleMedia||window.media;if(!a){var b=document.createElement("style"),c=document.getElementsByTagName("script")[0],d=null;b.type="text/css",b.id="matchmediajs-test",c.parentNode.insertBefore(b,c),d="getComputedStyle"in window&&window.getComputedStyle(b,null)||b.currentStyle,a={matchMedium:function(a){var c="@media "+a+"{ #matchmediajs-test { width: 1px; } }";return b.styleSheet?b.styleSheet.cssText=c:b.textContent=c,"1px"===d.width}}}return function(b){return{matches:a.matchMedium(b||"all"),media:b||"all"}}}()),function(a,b,c){"use strict";function d(b){"object"==typeof module&&"object"==typeof module.exports?module.exports=b:"function"==typeof define&&define.amd&&define("picturefill",function(){return b}),"object"==typeof a&&(a.picturefill=b)}function e(a)
@theStreets93
theStreets93 / ReviewStars.js
Last active April 4, 2016 09:45
Magento 1 - Review Stars - Prototype
document.observe('dom:loaded', function(){
$$('#product-review-table td input').each(function(el){
el.observe('click', function(ev){
var attr = el.readAttribute('value');
var tr = el.up('tr');
tr.className = "";
tr.addClassName('star_' + attr);
});
});
});
@theStreets93
theStreets93 / fancySelect.js
Last active May 9, 2016 10:02
Fancy Select
var Inchoo = Inchoo || {};
/*
* @note: all credits for attribute change logic goes to:
* https://github.com/meetselva/attrchange/blob/master/attrchange.js
* http://stackoverflow.com/questions/10868104/can-you-have-a-javascript-hook-trigger-after-a-dom-elements-style-object-change
*
**/
Inchoo.fancySelect = Class.create({
@theStreets93
theStreets93 / WP_query_sample
Last active January 3, 2016 14:09
WP Query post
<?php
$args = array(
'cat' => '2',
'showpost' => 5
);
query_posts( $args );
while ( have_posts() ) : the_post();
?>
<div class="post-wrapper">
<?php the_post_thumbnail('size', array('class' => 'post-image')); ?>
jQuery(document).ready(function($){
jQuery( 'ul.products li.pif-has-gallery a:first-child' ).hover( function() {
jQuery( this ).find( '.wp-post-image' ).removeClass( 'fadeInDown' ).addClass( 'animated fadeOutUp' );
jQuery( this ).find( '.secondary-image' ).removeClass( 'fadeOutUp' ).addClass( 'animated fadeInDown' );
}, function() {
jQuery( this ).find( '.wp-post-image' ).removeClass( 'fadeOutUp' ).addClass( 'fadeInDown' );
jQuery( this ).find( '.secondary-image' ).removeClass( 'fadeInDown' ).addClass( 'fadeOutUp' );
});
});
@theStreets93
theStreets93 / app.js
Last active November 24, 2015 17:08
jQuery Tab Navigation
jQuery(document).ready(function(){
tabTrigger = jQuery('.tab-trigger');
tabContent = jQuery('.tab-content');
tabTrigger.on('click', function(){
tabTrigger.removeClass('open');
jQuery(this).addClass('open');
var thisRel = jQuery(this).attr('rel');
@theStreets93
theStreets93 / WP_if_page_id.php
Last active November 10, 2015 10:46
Wordpress - If page id or home page
<?php if (is_page('page_ID_or_SLUG')): /* if wp page what you want, get content */ endif; ?>
<?php if(is_home()): /* if wp home get content */ endif; ?>
@theStreets93
theStreets93 / WP_if_post_type.php
Last active November 10, 2015 10:46
Wordpress - If post type
<?php /* if Your post type, get content...*/
if ( 'yourPostType' == get_post_type() ):
/* get Your content */
endif;
?>