This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/Modernizr/Modernizr/issues/1894#issuecomment-198035521 | |
window.passiveEventsSupport = function passiveEventsSupport() { | |
if (passiveEventsSupport.supportsPassive !== undefined) { | |
return passiveEventsSupport.supportsPassive | |
} | |
var supportsPassive = false | |
var opts = Object.defineProperty && Object.defineProperty({}, 'passive', { | |
get: function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wp_cache_delete_group($group) | |
{ | |
/** @type WP_Object_Cache $wp_object_cache */ | |
global $wp_object_cache; | |
$cache = $wp_object_cache->cache; | |
if (isset($cache[$group])) | |
{ | |
unset($cache[$group]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function () { | |
function getWebpSupport() { | |
var canvas = document.createElement('canvas'); | |
return canvas && canvas.getContext && canvas.toDataURL('image/webp').indexOf('data:image/webp') == 0 | |
} | |
var webpSupport | |
if (document.cookie.indexOf('webp') == -1) { | |
webpSupport = getWebpSupport() && 1 || 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Using: | |
* var queue = new RafAnimationQueue(defaultContext) | |
* queue.add(firstAnimationFrameCallback) // firstAnimationFrameCallback will executed with defaultContext | |
* queue.add(secondAnimationFrameCallback, customContext) | |
* queue.delay() // skip just one frame | |
* queue.clear() // clear animation queue | |
**/ | |
window.RafAnimationQueue = (function () { | |
function RafAnimationQueue(context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.templateTrim = function (templateHtml) { | |
return templateHtml.replace(/\/{2,}<!\[CDATA\[([\s\S]*)\/{2,}]]>/i, '$1').trim() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
function embed_svg($svg_path, $image_class = '', Array $attributes = array(), $is_abs_path = FALSE) | |
{ | |
if (!$is_abs_path) | |
{ | |
$image_path = get_template_directory() . '/static/img/' . trim($svg_path, ' /'); | |
} | |
else | |
{ | |
$image_path = $svg_path; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage: | |
* function MainClass() {} | |
* MainClass.prototype.delegate() {console.log('Main')} | |
* var methods = { delegate: function () { console.log('Sub') } } | |
* var SubClass = trait(MainClass, methods) | |
* new SubClass().delegate() // >>> Main, Sub | |
*/ | |
define(function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['promise'], function () { | |
// Use any Promise polyfill | |
var imgClasses = [HTMLImageElement], | |
imgElementsList = ['img'] | |
if (window.HTMLPictureElement) { | |
imgClasses.push(HTMLPictureElement) | |
imgElementsList.push('picture') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function () { | |
function addHtmlClass(klass) { | |
document.documentElement.setAttribute('class', document.documentElement.getAttribute('class') || '' + ' ' + klass + ' ') | |
} | |
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera\s+Mini/i.test(navigator.userAgent)) { | |
window.fullVersionCookieTest = /nomobile\s*=\s*1(;\s*)?/ig | |
window.isFullVersion = fullVersionCookieTest.test(document.cookie) | |
if (!isFullVersion) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getBgImageUrl($el) { | |
var el = $el instanceof HTMLElement ? $el : (window.jQuery && $el instanceof window.jQuery && $el.get(0)) | |
if (!el) { | |
return '' | |
} | |
var backgroundImage = getComputedStyle(el).backgroundImage | |
if (!backgroundImage || backgroundImage === 'none') { |