Initial Commit

This commit is contained in:
Rumperuu 2018-03-21 18:19:20 +00:00
parent 4c352bf02e
commit 1ab6e5f0b0
1085 changed files with 195258 additions and 0 deletions

View file

@ -0,0 +1,159 @@
/* jshint onevar:false */
/* global audioshortcode */
// Note: This file no longer exists on wpcom.
(function($) {
window.audioshortcode = {
/**
* Prep the audio player once the page is ready, add listeners, etc
*/
prep: function( player_id, files, titles, volume, loop ) {
// check if the player has already been prepped, no-op if it has
var container = $( '#wp-as-' + player_id + '-container' );
if ( container.hasClass( 'wp-as-prepped' ) ) {
return;
}
container.addClass( 'wp-as-prepped' );
// browser doesn't support HTML5 audio, no-op
if ( ! document.createElement('audio').canPlayType ) {
return;
}
// if the browser removed the script, no-op
var player = $( '#wp-as-' + player_id ).get(0);
if ( typeof player === 'undefined' ) {
return;
}
this[player_id] = [];
this[player_id].i = 0;
this[player_id].files = files;
this[player_id].titles = titles;
player.volume = volume;
var type_map = {
'mp3': 'mpeg',
'wav': 'wav',
'ogg': 'ogg',
'oga': 'ogg',
'm4a': 'mp4',
'aac': 'mp4',
'webm': 'webm'
};
// strip out all the files that can't be played
for ( var i = this[player_id].files.length-1; i >= 0; i-- ) {
var extension = this[player_id].files[i].split( '.' ).pop();
var type = 'audio/' + type_map[extension];
if ( ! player.canPlayType( type ) ) {
this.remove_track( player_id, i );
}
}
// bail if there are no more good files
if ( 0 === this[player_id].files.length ) {
return;
}
player.src = this[player_id].files[0];
// show the controls if there are still 2+ files remaining
if ( 1 < this[player_id].files.length ) {
$( '#wp-as-' + player_id + '-controls' ).show();
}
player.addEventListener( 'error', function() {
audioshortcode.remove_track( player_id, audioshortcode[player_id].i );
if ( 0 < audioshortcode[player_id].files.length ) {
audioshortcode[player_id].i--;
audioshortcode.next_track( player_id, false, loop );
}
}, false );
player.addEventListener( 'ended', function() {
audioshortcode.next_track( player_id, false, loop );
}, false );
player.addEventListener( 'play', function() {
var i = audioshortcode[player_id].i;
var titles = audioshortcode[player_id].titles;
$( '#wp-as-' + player_id + '-playing' ).text( ' ' + titles[i] );
}, false );
player.addEventListener( 'pause', function() {
$( '#wp-as-' + player_id + '-playing' ).text( '' );
}, false );
},
/**
* Remove the track and update the player/controls if needed
*/
remove_track: function( player_id, index ) {
this[player_id].files.splice( index, 1 );
this[player_id].titles.splice( index, 1 );
// get rid of player/controls if they can't be played
if ( 0 === this[player_id].files.length ) {
$( '#wp-as-' + player_id + '-container' ).html( $( '#wp-as-' + player_id + '-nope' ).html() );
$( '#wp-as-' + player_id + '-controls' ).html( '' );
} else if ( 1 === this[player_id].files.length ) {
$( '#wp-as-' + player_id + '-controls' ).html( '' );
}
},
/**
* Change the src of the player, load the file, then play it
*/
start_track: function( player_id, file ) {
var player = $( '#wp-as-' + player_id ).get(0);
player.src = file;
player.load();
player.play();
},
/**
* Play the previous track
*/
prev_track: function( player_id ) {
var player = $( '#wp-as-' + player_id ).get(0);
var files = this[player_id].files;
if ( player.paused || 0 === this[player_id].i ) {
return;
}
player.pause();
if ( 0 < this[player_id].i ) {
this[player_id].i--;
this.start_track( player_id, files[this[player_id].i] );
}
},
/**
* Play the next track
*/
next_track: function( player_id, fromClick, loop ) {
var player = $( '#wp-as-' + player_id ).get(0);
var files = this[player_id].files;
if ( fromClick && ( player.paused || files.length-1 === this[player_id].i ) ) {
return;
}
player.pause();
if ( files.length-1 > this[player_id].i ) {
this[player_id].i++;
this.start_track( player_id, files[this[player_id].i] );
} else if ( loop ) {
this[player_id].i = 0;
this.start_track( player_id, 0 );
} else {
this[player_id].i = 0;
player.src = files[0];
$( '#wp-as-' + player_id + '-playing' ).text( '' );
}
}
};
})(jQuery);

View file

@ -0,0 +1,28 @@
;(function( $, undefined ) {
var gistStylesheetLoaded = false,
gistEmbed = function() {
$( '.gist-oembed' ).each( function( i, el ) {
var url = 'https://gist.github.com/' + $( el ).data( 'gist' );
$.ajax( {
url: url,
dataType: 'jsonp'
} ).done( function( response ) {
$( el ).replaceWith( response.div );
if ( ! gistStylesheetLoaded ) {
var stylesheet = '<link rel="stylesheet" href="' +
response.stylesheet +
'" type="text/css" />';
$( 'head' ).append( stylesheet );
gistStylesheetLoaded = true;
}
} );
} );
};
$( document ).ready( gistEmbed );
$( 'body' ).on( 'post-load', gistEmbed );
})( jQuery );

View file

@ -0,0 +1,19 @@
(function( instgrm ) {
var instagramEmbed = function() {
if ( 'undefined' !== typeof instgrm && instgrm.Embeds && instgrm.Embeds.process ) {
instgrm.Embeds.process();
} else {
var s = document.createElement( 'script' );
s.async = true;
s.defer = true;
s.src = '//platform.instagram.com/en_US/embeds.js';
document.getElementsByTagName( 'body' )[0].appendChild( s );
}
};
if ( 'undefined' !== typeof jQuery && 'undefined' !== typeof infiniteScroll ) {
jQuery( document.body ).on( 'post-load', instagramEmbed );
}
instagramEmbed();
})();

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,258 @@
(function($){
var jmpressOpts = {
fullscreen : false,
hash : { use : false },
mouse : { clickSelects : false },
keyboard : { use : true },
animation : { transitionDuration : '1s' },
presentationMode : false,
stepSelector : '.step',
duration : {
defaultValue: 0
}
};
/**
* Presentation constructor
*/
function Presentation (wrapper) {
var _self, duration, new_css, ie_regex, matches;
_self = this;
_self.wrapper = $(wrapper); // The wrapper for toggling fullscreen
_self.slideshow = $('.presentation', wrapper); // Holds the slides for jmpress
_self.navLeft = $('.nav-arrow-left', wrapper);
_self.navRight = $('.nav-arrow-right', wrapper);
_self.expandButton = $('.nav-fullscreen-button', wrapper);
_self.overlay = $('.autoplay-overlay', wrapper);
_self.fullscreen = false;
_self.autoPlaying = false;
_self.autoplayTime = parseFloat(_self.slideshow.attr('data-autoplay'), 10) || 0;
// The wrapper is scaled to the contents' size so that its border wraps tightly
_self.wrapper.css({
width: _self.slideshow.width(),
height: _self.slideshow.height()
});
duration = _self.slideshow.attr('duration') || '1s';
jmpressOpts.animation.transitionDuration = duration;
// Compensate for transition times
if( _self.autoplayTime ) {
_self.autoplayTime += parseFloat(duration, 10) * 1000;
}
// Set the opacity transition duration
// as it is delegated by css and not jmpress
duration = 'opacity ' + duration;
new_css = {
'width' : _self.slideshow.width(),
'height' : _self.slideshow.height(),
'-webkit-transition': duration,
'-moz-transition' : duration,
'-ms-transition' : duration,
'-o-transition' : duration,
'transition' : duration
};
$('.step', _self.slideshow).each(function(i, step) {
$(step).css(new_css);
});
// Apply attribute to allow fading individual bullets here,
// otherwise wp_kses will strip the attribute out
$('.step.fadebullets li', _self.slideshow).each(function(i, step) {
$(step).attr('data-jmpress', 'fade');
});
// Register resizing to window when fullscreen
$(window).resize(function() {
if ( _self.fullscreen ) {
_self.resizePresentation();
}
});
// Register the nav bars to move the slides
_self.navLeft.on('click', function(){
_self.slideshow.jmpress('prev');
_self.overlay.css('opacity', 0);
return false;
});
_self.navRight.on('click', function(){
_self.slideshow.jmpress('next');
_self.overlay.css('opacity', 0);
return false;
});
_self.slideshow.on('click', function() {
_self.setAutoplay(true);
return false;
});
_self.slideshow.on('focusout', function() {
_self.setAutoplay(false);
});
// Register toggling fullscreen except for IE 9 or lower
ie_regex = /MSIE\s(\d+)\.\d+/;
matches = ie_regex.exec(navigator.userAgent);
if ( matches && parseInt(matches[1], 10) < 10 ) {
_self.expandButton.remove();
_self.expandButton = null;
} else {
_self.expandButton.on('click', function() {
_self.setFullscreen( !_self.fullscreen );
return false;
});
}
// Register ESC key to exit fullscreen
$(window).on('keydown', function( event ) {
if ( event.which === 27 ) {
_self.setFullscreen( false );
}
});
// Start the presentation
_self.slideshow.jmpress(jmpressOpts);
// Make content visible and remove error message on jmpress success
if ( _self.slideshow.jmpress('initialized') ) {
_self.slideshow.css('display', '');
_self.overlay.css('display', '');
$('.not-supported-msg', _self.wrapper).remove();
}
// A bug in Firefox causes issues with the nav arrows appearing
// on hover in presentation mode. Explicitly disabling fullscreen
// on init seems to fix the issue
_self.setFullscreen( false );
}
$.extend( Presentation.prototype, {
resizePresentation: function () {
var scale, duration, settings, new_css, widthScale, heightScale;
// Set the animation duration to 0 during resizing
// so that there isn't an animation delay when scaling
// up the slide contents
settings = this.slideshow.jmpress('settings');
duration = settings.animation.transitionDuration;
settings.animation.transitionDuration = '0s';
this.slideshow.jmpress('reselect');
scale = 1;
new_css = {
top : 0,
left : 0,
zoom : 1
};
// Expand the presentation to fill the lesser of the max width or height
// This avoids content moving past the window for certain window sizes
if ( this.fullscreen ) {
widthScale = $(window).width() / this.slideshow.width();
heightScale = $(window).height() / this.slideshow.height();
scale = Math.min(widthScale, heightScale);
new_css.top = ( $(window).height() - (scale * this.slideshow.height()) ) / 2;
new_css.left = ( $(window).width() - (scale * this.slideshow.width() ) ) / 2;
}
// Firefox does not support the zoom property; IE does, but it does not work
// well like in webkit, so we manually transform and position the slideshow
if ( this.slideshow.css('-moz-transform') || this.slideshow.css('-ms-transform') ) {
// Firefox keeps the center of the element in place and expands outward
// so we must shift everything to compensate
new_css.top += (scale - 1) * this.slideshow.height() / 2;
new_css.left += (scale - 1) * this.slideshow.width() / 2;
scale = 'scale(' + scale + ')';
$.extend(new_css, {
'-moz-transform' : scale,
'-ms-transform' : scale,
'transform' : scale
});
} else {
// webkit scales everything with zoom so we need to offset the right amount
// so that the content is vertically centered after scaling effects
new_css.top /= scale;
new_css.left /= scale;
new_css.zoom = scale;
}
this.slideshow.css(new_css);
settings.animation.transitionDuration = duration;
this.slideshow.jmpress('reselect');
},
setFullscreen: function ( on ) {
this.fullscreen = on;
this.setAutoplay(false);
// Save the scroll positions before going into fullscreen mode
if ( on ) {
this.scrollVert = $(window).scrollTop();
this.scrollHoriz = $(window).scrollLeft();
// Chrome Bug: Force scroll to be at top
// otherwise the presentation can end up offscreen
$(window).scrollTop(0);
$(window).scrollLeft(0);
}
$('html').toggleClass('presentation-global-fullscreen', on);
$('body').toggleClass('presentation-global-fullscreen', on);
this.wrapper.toggleClass('presentation-wrapper-fullscreen', on);
this.wrapper.parents().each(function(i, e){
$(e).toggleClass('presentation-wrapper-fullscreen-parent', on);
});
this.resizePresentation();
// Reset the scroll positions after exiting fullscreen mode
if ( !on ) {
$(window).scrollTop(this.scrollVert);
$(window).scrollLeft(this.scrollHoriz);
}
},
setAutoplay: function ( on ) {
var _self = this, newAutoplayTime;
if ( _self.autoPlaying === on ) {
return;
}
newAutoplayTime = (on && _self.autoplayTime > 0) ? _self.autoplayTime : 0;
_self.slideshow.jmpress('settings').duration.defaultValue = newAutoplayTime;
// Move to the next slide when activating autoplay
if( newAutoplayTime ) {
_self.slideshow.jmpress('next');
_self.overlay.css('opacity', 0);
} else {
_self.slideshow.jmpress('reselect');
}
_self.autoPlaying = on;
}
});
$( document ).ready( function(){
$('.presentation-wrapper').map(function() {
new Presentation(this);
});
});
})(jQuery);

View file

@ -0,0 +1,170 @@
/*
* printThis v1.3
* @desc Printing plug-in for jQuery
* @author Jason Day
*
* Resources (based on) :
* jPrintArea: http://plugins.jquery.com/project/jPrintArea
* jqPrint: https://github.com/permanenttourist/jquery.jqprint
* Ben Nadal: http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* (c) Jason Day 2013
*
* Usage:
*
* $("#mySelector").printThis({
* debug: false, * show the iframe for debugging
* importCSS: true, * import page CSS
* printContainer: true, * grab outer container as well as the contents of the selector
* loadCSS: "path/to/my.css", * path to additional css file
* pageTitle: "", * add title to print page
* removeInline: false, * remove all inline styles from print elements
* printDelay: 333, * variable print delay S. Vance
* header: null * prefix to html
* });
*
* Notes:
* - the loadCSS will load additional css (with or without @media print) into the iframe, adjusting layout
*/
/* jshint onevar: false, smarttabs: true, devel: true */
;(function ($) {
var opt;
$.fn.printThis = function (options) {
opt = $.extend({}, $.fn.printThis.defaults, options);
var $element = this instanceof jQuery ? this : $(this);
var strFrameName = 'printThis-' + (new Date()).getTime();
if(window.location.hostname !== document.domain && navigator.userAgent.match(/msie/i)){
// Ugly IE hacks due to IE not inheriting document.domain from parent
// checks if document.domain is set by comparing the host name against document.domain
var iframeContents = '<head><script>document.domain=\\\'' + document.domain + '\\\';</script></head><body></body>';
var iframeSrc = 'data:text/html;charset=utf-8,' + encodeURI(iframeContents);
var printI= document.createElement('iframe');
printI.name = 'printIframe';
printI.id = strFrameName;
printI.className = 'MSIE';
document.body.appendChild(printI);
printI.src = iframeSrc;
} else {
// other browsers inherit document.domain, and IE works if document.domain is not explicitly set
var $frame = $('<iframe id="' + strFrameName +'" name="printIframe" />');
$frame.appendTo('body');
}
var $iframe = $('#' + strFrameName);
// show frame if in debug mode
if (!opt.debug) {
$iframe.css({
position: 'absolute',
width: '0px',
height: '0px',
left: '-600px',
top: '-600px'
});
}
// $iframe.ready() and $iframe.load were inconsistent between browsers
setTimeout ( function () {
var $doc = $iframe.contents();
// import page stylesheets
if (opt.importCSS) {
$('link[rel=stylesheet]').each(function () {
var href = $(this).attr('href');
if (href) {
var media = $(this).attr('media') || 'all';
$doc.find('head').append('<link type="text/css" rel="stylesheet" href="' + href + '" media="' + media + '">');
}
});
}
//add title of the page
if (opt.pageTitle) {
$doc.find('head').append('<title>' + opt.pageTitle + '</title>');
}
// import additional stylesheet
if (opt.loadCSS) {
$doc.find('head').append('<link type="text/css" rel="stylesheet" href="' + opt.loadCSS + '">');
}
// print header
if (opt.header) {
$doc.find('body').append(opt.header);
}
// grab $.selector as container
if (opt.printContainer) {
$doc.find('body').append($element.outer());
}
// otherwise just print interior elements of container
else {
$element.each(function () {
$doc.find('body').append($(this).html());
});
}
// remove inline styles
if (opt.removeInline) {
// $.removeAttr available jQuery 1.7+
if ($.isFunction($.removeAttr)) {
$doc.find('body *').removeAttr('style');
} else {
$doc.find('body *').attr('style', '');
}
}
setTimeout(function () {
if($iframe.hasClass('MSIE')){
// check if the iframe was created with the ugly hack
// and perform another ugly hack out of neccessity
window.frames.printIframe.focus();
$doc.find('head').append('<script> window.print(); </script>');
} else {
// proper method
$iframe[0].contentWindow.focus();
$iframe[0].contentWindow.print();
}
$element.trigger( 'done');
//remove iframe after print
if (!opt.debug) {
setTimeout(function () {
$iframe.remove();
}, 1000);
}
}, opt.printDelay);
}, 333 );
};
// defaults
$.fn.printThis.defaults = {
debug: false, // show the iframe for debugging
importCSS: false, // import parent page css
printContainer: true, // print outer container/$.selector
loadCSS: '', // load an additional css file
pageTitle: '', // add title to print page
removeInline: false, // remove all inline styles
printDelay: 333, // variable print delay S. Vance
header: null // prefix to html
};
// $.selector container
jQuery.fn.outer = function () {
return $($('<div></div>').html(this.clone())).html();
};
})(jQuery);

View file

@ -0,0 +1,11 @@
/* global jetpack_recipes_vars */
( function( $ ) {
$( window ).load( function() {
$( '.jetpack-recipe-print a' ).click( function( event ) {
event.preventDefault();
// Print the DIV.
$( this ).closest( '.jetpack-recipe' ).printThis( { pageTitle: jetpack_recipes_vars.pageTitle, loadCSS: jetpack_recipes_vars.loadCSS } );
} );
} );
} )( jQuery );

View file

@ -0,0 +1,193 @@
/* jshint onevar:false, loopfunc:true */
/* global jetpackSlideshowSettings, escape */
function JetpackSlideshow( element, transition, autostart ) {
this.element = element;
this.images = [];
this.controls = {};
this.transition = transition || 'fade';
this.autostart = autostart;
}
JetpackSlideshow.prototype.showLoadingImage = function( toggle ) {
if ( toggle ) {
this.loadingImage_ = document.createElement( 'div' );
this.loadingImage_.className = 'slideshow-loading';
var img = document.createElement( 'img' );
img.src = jetpackSlideshowSettings.spinner;
this.loadingImage_.appendChild( img );
this.loadingImage_.appendChild( this.makeZeroWidthSpan() );
this.element.append( this.loadingImage_ );
} else if ( this.loadingImage_ ) {
this.loadingImage_.parentNode.removeChild( this.loadingImage_ );
this.loadingImage_ = null;
}
};
JetpackSlideshow.prototype.init = function() {
this.showLoadingImage(true);
var self = this;
// Set up DOM.
for ( var i = 0; i < this.images.length; i++ ) {
var imageInfo = this.images[i];
var img = document.createElement( 'img' );
img.src = imageInfo.src;
img.title = typeof( imageInfo.title ) !== 'undefined' ? imageInfo.title : '';
img.alt = typeof( imageInfo.alt ) !== 'undefined' ? imageInfo.alt : '';
img.align = 'middle';
img.setAttribute('itemprop','image');
img.nopin = 'nopin';
var caption = document.createElement( 'div' );
caption.className = 'slideshow-slide-caption';
caption.setAttribute('itemprop','caption description');
caption.innerHTML = imageInfo.caption;
var container = document.createElement('div');
container.className = 'slideshow-slide';
container.setAttribute('itemprop','associatedMedia');
container.setAttribute('itemscope','');
container.setAttribute('itemtype','http://schema.org/ImageObject');
// Hide loading image once first image has loaded.
if ( i === 0 ) {
if ( img.complete ) {
// IE, image in cache
setTimeout( function() {
self.finishInit_();
}, 1);
} else {
jQuery( img ).load(function() {
self.finishInit_();
});
}
}
container.appendChild( img );
// I'm not sure where these were coming from, but IE adds
// bad values for width/height for portrait-mode images
img.removeAttribute('width');
img.removeAttribute('height');
container.appendChild( this.makeZeroWidthSpan() );
container.appendChild( caption );
this.element.append( container );
}
};
JetpackSlideshow.prototype.makeZeroWidthSpan = function() {
var emptySpan = document.createElement( 'span' );
emptySpan.className = 'slideshow-line-height-hack';
// Having a NBSP makes IE act weird during transitions, but other
// browsers ignore a text node with a space in it as whitespace.
if ( -1 !== window.navigator.userAgent.indexOf( 'MSIE ' ) ) {
emptySpan.appendChild( document.createTextNode(' ') );
} else {
emptySpan.innerHTML = '&nbsp;';
}
return emptySpan;
};
JetpackSlideshow.prototype.finishInit_ = function() {
this.showLoadingImage( false );
this.renderControls_();
var self = this;
if ( this.images.length > 1 ) {
// Initialize Cycle instance.
this.element.cycle( {
fx: this.transition,
prev: this.controls.prev,
next: this.controls.next,
slideExpr: '.slideshow-slide',
onPrevNextEvent: function() {
return self.onCyclePrevNextClick_.apply( self, arguments );
}
} );
var slideshow = this.element;
if ( ! this.autostart ) {
slideshow.cycle( 'pause' );
jQuery(this.controls.stop).removeClass( 'running' );
jQuery(this.controls.stop).addClass( 'paused' );
}
jQuery( this.controls.stop ).click( function() {
var button = jQuery(this);
if ( ! button.hasClass( 'paused' ) ) {
slideshow.cycle( 'pause' );
button.removeClass( 'running' );
button.addClass( 'paused' );
} else {
button.addClass( 'running' );
button.removeClass( 'paused' );
slideshow.cycle( 'resume', true );
}
return false;
} );
} else {
this.element.children( ':first' ).show();
this.element.css( 'position', 'relative' );
}
this.initialized_ = true;
};
JetpackSlideshow.prototype.renderControls_ = function() {
if ( this.controlsDiv_ ) {
return;
}
var controlsDiv = document.createElement( 'div' );
controlsDiv.className = 'slideshow-controls';
var controls = [ 'prev', 'stop', 'next' ];
for ( var i = 0; i < controls.length; i++ ) {
var controlName = controls[i];
var a = document.createElement( 'a' );
a.href = '#';
controlsDiv.appendChild( a );
this.controls[controlName] = a;
}
this.element.append( controlsDiv );
this.controlsDiv_ = controlsDiv;
};
JetpackSlideshow.prototype.onCyclePrevNextClick_ = function( isNext, i/*, slideElement*/ ) {
// If blog_id not present don't track page views
if ( ! jetpackSlideshowSettings.blog_id ) {
return;
}
var postid = this.images[i].id;
var stats = new Image();
stats.src = document.location.protocol +
'//pixel.wp.com/g.gif?host=' +
escape( document.location.host ) +
'&rand=' + Math.random() +
'&blog=' + jetpackSlideshowSettings.blog_id +
'&subd=' + jetpackSlideshowSettings.blog_subdomain +
'&user_id=' + jetpackSlideshowSettings.user_id +
'&post=' + postid +
'&ref=' + escape( document.location );
};
( function ( $ ) {
function jetpack_slideshow_init() {
$( '.jetpack-slideshow-noscript' ).remove();
$( '.jetpack-slideshow' ).each( function () {
var container = $( this );
if ( container.data( 'processed' ) ) {
return;
}
var slideshow = new JetpackSlideshow( container, container.data( 'trans' ), container.data( 'autostart' ) );
slideshow.images = container.data( 'gallery' );
slideshow.init();
container.data( 'processed', true );
} );
}
$( document ).ready( jetpack_slideshow_init );
$( 'body' ).on( 'post-load', jetpack_slideshow_init );
} )( jQuery );