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
// Round value to nearest <n> | |
// multiplier allows values to be multiplied and stay rounded to nearest <n> | |
// (i.e. 1732 * 2 => nearest 50) | |
function RoundTo ( value, to, multiplier ) { | |
multiplier = multiplier || 1; | |
return Math.round( ( parseInt( value ) * multiplier ) / to ) * to; | |
} |
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
// Example of ellipsizing | |
$( function () { | |
var ellipsis_length = 10; | |
// Ellipsize text | |
var text_elements = $('.promotion__content__text *'); | |
// Flip through content elements looking for ellipsis boundary | |
var boundary = null; | |
text_elements.each( 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
// Pull all crons from options | |
$crons = get_option('cron'); | |
// Kill each one. Filter by timestamp or hook_name if desired. | |
foreach ($crons as $timestamp => $hook) { | |
foreach ($hook as $hook_name => $details) { | |
wp_unschedule_event( $timestamp, $hook_name ); | |
} | |
} |
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 () { | |
var waiting = setInterval( function () { | |
var nodes = document.querySelectorAll('.inline-svg[class^="icon-"], .inline-svg[class*=" icon-"]'); | |
for ( var i = 0; i < nodes.length; i++ ) { | |
// Pull the background in (this should always be a background image) | |
var background = document.defaultView.getComputedStyle(nodes[i])['background-image']; | |
// Check to see if an element has a background - if so, background has loaded | |
if (background && background !== 'none') { | |
if ( waiting ) clearInterval( waiting ); |
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
$('.jscrollpane__container').jScrollPane().bind( 'mouseup.jsp', function () { | |
$('html').unbind('dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp'); | |
// This will remove the active class from ALL windows, so keep that in mind | |
// if that isn't the desired behavior. | |
$('.jspActive').removeClass( 'jspActive' ); | |
}); |
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
/* Youtube */ | |
window.onYouTubeIframeAPIReady = function () { | |
window.youtube_players = []; | |
$('.video_container.youtube').each( function () { | |
// Only set the play functionality up if the video has a thumbnail | |
if ( $(this).find('.video_thumbnail').length ) { | |
var thumbnail = $(this).find('.video_thumbnail'), | |
play = $(this).find('.video_play'), | |
player = new YT.Player( $(this).children('iframe').attr('id') ); | |
window.youtube_players.push( player ); |
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
/* Vimeo */ | |
window.vimeo_players = []; | |
$('.video_container.vimeo').each( function () { | |
$f($(this).find('iframe')[0]).addEvent( 'ready', (function ( player_id ) { | |
if ( ! $(this).hasClass('no_thumbnail') ) { | |
var thumbnail = $(this).find('.video_thumbnail'), | |
play = $(this).find('.video_play'), | |
player = $f( player_id ); | |
window.vimeo_players.push( player ); | |
var thumbnail_height = thumbnail.find('img').height(); |
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
$combined = array_filter($array1, function ($a) use ($array2) { | |
$found = array_filter($array2, function ($b) use ($a) { | |
return ((int) $a->ID) === ((int) $b->ID); | |
}); | |
return !empty($found); | |
}); |
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
return ('' + str).match( /[A-Z]?[a-z]+/g ) | |
.map( function ( v ) { return v.substr( 0, 1 ).toUpperCase() + v.substr( 1, v.length ); } ) | |
.join( ' ' ); |
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
'use strict'; | |
/** | |
* Simple directive for emitting an event when repeat is finished | |
*/ | |
App.directive( 'repeatDoneEvent', function ( $window ) { | |
return function( scope, element, attrs ) { | |
if ( scope.$last ) { | |
// At this point, ng-repeat is done populating - but we're not finished | |
// yet because $compile still has to compile any tags in the repeat |
OlderNewer