Start Theme Repo
This commit is contained in:
165
assets/treville/js/customize-preview.js
Executable file
165
assets/treville/js/customize-preview.js
Executable file
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
* Customizer Live Preview
|
||||
*
|
||||
* Reloads changes on Theme Customizer Preview asynchronously for better usability
|
||||
*
|
||||
* @package Treville
|
||||
*/
|
||||
|
||||
( function( $ ) {
|
||||
|
||||
// Site Title textfield.
|
||||
wp.customize( 'blogname', function( value ) {
|
||||
value.bind( function( to ) {
|
||||
$( '.site-title a' ).text( to );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Site Description textfield.
|
||||
wp.customize( 'blogdescription', function( value ) {
|
||||
value.bind( function( to ) {
|
||||
$( '.site-description' ).text( to );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Site Title checkbox.
|
||||
wp.customize( 'romhackplaza_theme_options[site_title]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( false === newval ) {
|
||||
hideElement( '.site-title' );
|
||||
} else {
|
||||
showElement( '.site-title' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// Site Description checkbox.
|
||||
wp.customize( 'romhackplaza_theme_options[site_description]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( false === newval ) {
|
||||
hideElement( '.site-description' );
|
||||
} else {
|
||||
showElement( '.site-description' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// Sidebar Position.
|
||||
wp.customize( 'romhackplaza_theme_options[layout]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( 'left-sidebar' === newval && false === $( 'body' ).hasClass( 'no-sidebar' ) ) {
|
||||
$( 'body' ).addClass( 'sidebar-left' );
|
||||
} else {
|
||||
$( 'body' ).removeClass( 'sidebar-left' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// Blog Title textfield.
|
||||
wp.customize( 'romhackplaza_theme_options[blog_title]', function( value ) {
|
||||
value.bind( function( to ) {
|
||||
$( '.blog-header .blog-title' ).text( to );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Blog Description textfield.
|
||||
wp.customize( 'romhackplaza_theme_options[blog_description]', function( value ) {
|
||||
value.bind( function( to ) {
|
||||
$( '.blog-header .blog-description' ).text( to );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Read More textfield.
|
||||
wp.customize( 'romhackplaza_theme_options[read_more_text]', function( value ) {
|
||||
value.bind( function( to ) {
|
||||
$( 'a.more-link' ).text( to );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Post Date checkbox.
|
||||
wp.customize( 'romhackplaza_theme_options[meta_date]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( false === newval ) {
|
||||
$( 'body' ).addClass( 'date-hidden' );
|
||||
} else {
|
||||
$( 'body' ).removeClass( 'date-hidden' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// Post Author checkbox.
|
||||
wp.customize( 'romhackplaza_theme_options[meta_author]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( false === newval ) {
|
||||
$( 'body' ).addClass( 'author-hidden' );
|
||||
} else {
|
||||
$( 'body' ).removeClass( 'author-hidden' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// Post Comments checkbox.
|
||||
wp.customize( 'romhackplaza_theme_options[meta_comments]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( false === newval ) {
|
||||
$( 'body' ).addClass( 'comments-hidden' );
|
||||
} else {
|
||||
$( 'body' ).removeClass( 'comments-hidden' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// Post Categories checkbox.
|
||||
wp.customize( 'romhackplaza_theme_options[meta_category]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( false === newval ) {
|
||||
hideElement( '.type-post .entry-footer .entry-categories' );
|
||||
} else {
|
||||
showElement( '.type-post .entry-footer .entry-categories' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// Post Tags checkbox.
|
||||
wp.customize( 'romhackplaza_theme_options[meta_tags]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( false === newval ) {
|
||||
hideElement( '.type-post .entry-footer .entry-tags' );
|
||||
} else {
|
||||
showElement( '.type-post .entry-footer .entry-tags' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// Post Navigation checkbox.
|
||||
wp.customize( 'romhackplaza_theme_options[post_navigation]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( false === newval ) {
|
||||
hideElement( '.type-post .post-navigation' );
|
||||
} else {
|
||||
showElement( '.type-post .post-navigation' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
function hideElement( element ) {
|
||||
$( element ).css({
|
||||
clip: 'rect(1px, 1px, 1px, 1px)',
|
||||
position: 'absolute',
|
||||
width: '1px',
|
||||
height: '1px',
|
||||
overflow: 'hidden'
|
||||
});
|
||||
}
|
||||
|
||||
function showElement( element ) {
|
||||
$( element ).css({
|
||||
clip: 'auto',
|
||||
position: 'relative',
|
||||
width: 'auto',
|
||||
height: 'auto',
|
||||
overflow: 'visible'
|
||||
});
|
||||
}
|
||||
|
||||
} )( jQuery );
|
||||
52
assets/treville/js/customizer-controls.js
Executable file
52
assets/treville/js/customizer-controls.js
Executable file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Customizer Controls JS
|
||||
*
|
||||
* Adds Javascript for Customizer Controls.
|
||||
*
|
||||
* @package Treville
|
||||
*/
|
||||
|
||||
( function( wp, $ ) {
|
||||
|
||||
// Based on https://make.xwp.co/2016/07/24/dependently-contextual-customizer-controls/
|
||||
wp.customize( 'custom_logo', function( setting ) {
|
||||
setting.bind( function( value ) {
|
||||
if ( '' !== value ) {
|
||||
// Set retina logo option to false when a new logo image is uploaded.
|
||||
wp.customize.instance( 'romhackplaza_theme_options[retina_logo]' ).set( false );
|
||||
}
|
||||
});
|
||||
|
||||
var setupControl = function( control ) {
|
||||
var setActiveState, isDisplayed;
|
||||
isDisplayed = function() {
|
||||
return '' !== setting.get();
|
||||
};
|
||||
setActiveState = function() {
|
||||
control.active.set( isDisplayed() );
|
||||
};
|
||||
setActiveState();
|
||||
setting.bind( setActiveState );
|
||||
control.active.validate = isDisplayed;
|
||||
};
|
||||
wp.customize.control( 'romhackplaza_theme_options[retina_logo_title]', setupControl );
|
||||
wp.customize.control( 'romhackplaza_theme_options[retina_logo]', setupControl );
|
||||
} );
|
||||
|
||||
wp.customize( 'romhackplaza_theme_options[blog_layout]', function( setting ) {
|
||||
var setupControl = function( control ) {
|
||||
var setActiveState, isDisplayed;
|
||||
isDisplayed = function() {
|
||||
return 'excerpt' === setting.get();
|
||||
};
|
||||
setActiveState = function() {
|
||||
control.active.set( isDisplayed() );
|
||||
};
|
||||
setActiveState();
|
||||
setting.bind( setActiveState );
|
||||
control.active.validate = isDisplayed;
|
||||
};
|
||||
wp.customize.control( 'romhackplaza_theme_options[excerpt_length]', setupControl );
|
||||
} );
|
||||
|
||||
})( this.wp, jQuery );
|
||||
326
assets/treville/js/html5shiv.js
vendored
Executable file
326
assets/treville/js/html5shiv.js
vendored
Executable file
@@ -0,0 +1,326 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
;(function(window, document) {
|
||||
/*jshint evil:true */
|
||||
/** version */
|
||||
var version = '3.7.3';
|
||||
|
||||
/** Preset options */
|
||||
var options = window.html5 || {};
|
||||
|
||||
/** Used to skip problem elements */
|
||||
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
|
||||
|
||||
/** Not all elements can be cloned in IE **/
|
||||
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
|
||||
|
||||
/** Detect whether the browser supports default html5 styles */
|
||||
var supportsHtml5Styles;
|
||||
|
||||
/** Name of the expando, to work with multiple documents or to re-shiv one document */
|
||||
var expando = '_html5shiv';
|
||||
|
||||
/** The id for the the documents expando */
|
||||
var expanID = 0;
|
||||
|
||||
/** Cached data for each document */
|
||||
var expandoData = {};
|
||||
|
||||
/** Detect whether the browser supports unknown elements */
|
||||
var supportsUnknownElements;
|
||||
|
||||
(function() {
|
||||
try {
|
||||
var a = document.createElement('a');
|
||||
a.innerHTML = '<xyz></xyz>';
|
||||
//if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
|
||||
supportsHtml5Styles = ('hidden' in a);
|
||||
|
||||
supportsUnknownElements = a.childNodes.length == 1 || (function() {
|
||||
// assign a false positive if unable to shiv
|
||||
(document.createElement)('a');
|
||||
var frag = document.createDocumentFragment();
|
||||
return (
|
||||
typeof frag.cloneNode == 'undefined' ||
|
||||
typeof frag.createDocumentFragment == 'undefined' ||
|
||||
typeof frag.createElement == 'undefined'
|
||||
);
|
||||
}());
|
||||
} catch(e) {
|
||||
// assign a false positive if detection fails => unable to shiv
|
||||
supportsHtml5Styles = true;
|
||||
supportsUnknownElements = true;
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a style sheet with the given CSS text and adds it to the document.
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @param {String} cssText The CSS text.
|
||||
* @returns {StyleSheet} The style element.
|
||||
*/
|
||||
function addStyleSheet(ownerDocument, cssText) {
|
||||
var p = ownerDocument.createElement('p'),
|
||||
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
||||
|
||||
p.innerHTML = 'x<style>' + cssText + '</style>';
|
||||
return parent.insertBefore(p.lastChild, parent.firstChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of `html5.elements` as an array.
|
||||
* @private
|
||||
* @returns {Array} An array of shived element node names.
|
||||
*/
|
||||
function getElements() {
|
||||
var elements = html5.elements;
|
||||
return typeof elements == 'string' ? elements.split(' ') : elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends the built-in list of html5 elements
|
||||
* @memberOf html5
|
||||
* @param {String|Array} newElements whitespace separated list or array of new element names to shiv
|
||||
* @param {Document} ownerDocument The context document.
|
||||
*/
|
||||
function addElements(newElements, ownerDocument) {
|
||||
var elements = html5.elements;
|
||||
if(typeof elements != 'string'){
|
||||
elements = elements.join(' ');
|
||||
}
|
||||
if(typeof newElements != 'string'){
|
||||
newElements = newElements.join(' ');
|
||||
}
|
||||
html5.elements = elements +' '+ newElements;
|
||||
shivDocument(ownerDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data associated to the given document
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @returns {Object} An object of data.
|
||||
*/
|
||||
function getExpandoData(ownerDocument) {
|
||||
var data = expandoData[ownerDocument[expando]];
|
||||
if (!data) {
|
||||
data = {};
|
||||
expanID++;
|
||||
ownerDocument[expando] = expanID;
|
||||
expandoData[expanID] = data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived element for the given nodeName and document
|
||||
* @memberOf html5
|
||||
* @param {String} nodeName name of the element
|
||||
* @param {Document|DocumentFragment} ownerDocument The context document.
|
||||
* @returns {Object} The shived element.
|
||||
*/
|
||||
function createElement(nodeName, ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createElement(nodeName);
|
||||
}
|
||||
if (!data) {
|
||||
data = getExpandoData(ownerDocument);
|
||||
}
|
||||
var node;
|
||||
|
||||
if (data.cache[nodeName]) {
|
||||
node = data.cache[nodeName].cloneNode();
|
||||
} else if (saveClones.test(nodeName)) {
|
||||
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
|
||||
} else {
|
||||
node = data.createElem(nodeName);
|
||||
}
|
||||
|
||||
// Avoid adding some elements to fragments in IE < 9 because
|
||||
// * Attributes like `name` or `type` cannot be set/changed once an element
|
||||
// is inserted into a document/fragment
|
||||
// * Link elements with `src` attributes that are inaccessible, as with
|
||||
// a 403 response, will cause the tab/window to crash
|
||||
// * Script elements appended to fragments will execute when their `src`
|
||||
// or `text` property is set
|
||||
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived DocumentFragment for the given document
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The context document.
|
||||
* @returns {Object} The shived DocumentFragment.
|
||||
*/
|
||||
function createDocumentFragment(ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createDocumentFragment();
|
||||
}
|
||||
data = data || getExpandoData(ownerDocument);
|
||||
var clone = data.frag.cloneNode(),
|
||||
i = 0,
|
||||
elems = getElements(),
|
||||
l = elems.length;
|
||||
for(;i<l;i++){
|
||||
clone.createElement(elems[i]);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shivs the `createElement` and `createDocumentFragment` methods of the document.
|
||||
* @private
|
||||
* @param {Document|DocumentFragment} ownerDocument The document.
|
||||
* @param {Object} data of the document.
|
||||
*/
|
||||
function shivMethods(ownerDocument, data) {
|
||||
if (!data.cache) {
|
||||
data.cache = {};
|
||||
data.createElem = ownerDocument.createElement;
|
||||
data.createFrag = ownerDocument.createDocumentFragment;
|
||||
data.frag = data.createFrag();
|
||||
}
|
||||
|
||||
|
||||
ownerDocument.createElement = function(nodeName) {
|
||||
//abort shiv
|
||||
if (!html5.shivMethods) {
|
||||
return data.createElem(nodeName);
|
||||
}
|
||||
return createElement(nodeName, ownerDocument, data);
|
||||
};
|
||||
|
||||
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
|
||||
'var n=f.cloneNode(),c=n.createElement;' +
|
||||
'h.shivMethods&&(' +
|
||||
// unroll the `createElement` calls
|
||||
getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
|
||||
data.createElem(nodeName);
|
||||
data.frag.createElement(nodeName);
|
||||
return 'c("' + nodeName + '")';
|
||||
}) +
|
||||
');return n}'
|
||||
)(html5, data.frag);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Shivs the given document.
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The document to shiv.
|
||||
* @returns {Document} The shived document.
|
||||
*/
|
||||
function shivDocument(ownerDocument) {
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
var data = getExpandoData(ownerDocument);
|
||||
|
||||
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
||||
data.hasCSS = !!addStyleSheet(ownerDocument,
|
||||
// corrects block display not defined in IE6/7/8/9
|
||||
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
|
||||
// adds styling not present in IE6/7/8/9
|
||||
'mark{background:#FF0;color:#000}' +
|
||||
// hides non-rendered elements
|
||||
'template{display:none}'
|
||||
);
|
||||
}
|
||||
if (!supportsUnknownElements) {
|
||||
shivMethods(ownerDocument, data);
|
||||
}
|
||||
return ownerDocument;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The `html5` object is exposed so that more elements can be shived and
|
||||
* existing shiving can be detected on iframes.
|
||||
* @type Object
|
||||
* @example
|
||||
*
|
||||
* // options can be changed before the script is included
|
||||
* html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
|
||||
*/
|
||||
var html5 = {
|
||||
|
||||
/**
|
||||
* An array or space separated string of node names of the elements to shiv.
|
||||
* @memberOf html5
|
||||
* @type Array|String
|
||||
*/
|
||||
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video',
|
||||
|
||||
/**
|
||||
* current version of html5shiv
|
||||
*/
|
||||
'version': version,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the HTML5 style sheet should be inserted.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivCSS': (options.shivCSS !== false),
|
||||
|
||||
/**
|
||||
* Is equal to true if a browser supports creating unknown/HTML5 elements
|
||||
* @memberOf html5
|
||||
* @type boolean
|
||||
*/
|
||||
'supportsUnknownElements': supportsUnknownElements,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the document's `createElement` and `createDocumentFragment`
|
||||
* methods should be overwritten.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivMethods': (options.shivMethods !== false),
|
||||
|
||||
/**
|
||||
* A string to describe the type of `html5` object ("default" or "default print").
|
||||
* @memberOf html5
|
||||
* @type String
|
||||
*/
|
||||
'type': 'default',
|
||||
|
||||
// shivs the document according to the specified `html5` object options
|
||||
'shivDocument': shivDocument,
|
||||
|
||||
//creates a shived element
|
||||
createElement: createElement,
|
||||
|
||||
//creates a shived documentFragment
|
||||
createDocumentFragment: createDocumentFragment,
|
||||
|
||||
//extends list of elements
|
||||
addElements: addElements
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose html5
|
||||
window.html5 = html5;
|
||||
|
||||
// shiv the document
|
||||
shivDocument(document);
|
||||
|
||||
if(typeof module == 'object' && module.exports){
|
||||
module.exports = html5;
|
||||
}
|
||||
|
||||
}(typeof window !== "undefined" ? window : this, document));
|
||||
5
assets/treville/js/jquery.flexslider-min.js
vendored
Executable file
5
assets/treville/js/jquery.flexslider-min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
1195
assets/treville/js/jquery.flexslider.js
Executable file
1195
assets/treville/js/jquery.flexslider.js
Executable file
File diff suppressed because it is too large
Load Diff
130
assets/treville/js/navigation.js
Executable file
130
assets/treville/js/navigation.js
Executable file
@@ -0,0 +1,130 @@
|
||||
/* global trevilleScreenReaderText */
|
||||
/**
|
||||
* Theme Navigation
|
||||
*
|
||||
* @package Treville
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
// Create dropdown toggle button.
|
||||
function createDropdownToggle() {
|
||||
var dropdownToggle = document.createElement( 'button' );
|
||||
|
||||
// Add classes and aria attributes.
|
||||
dropdownToggle.classList.add( 'dropdown-toggle' );
|
||||
dropdownToggle.setAttribute( 'aria-expanded', 'false' );
|
||||
|
||||
// Add icon to dropdown toggle.
|
||||
var icon = new DOMParser().parseFromString( trevilleScreenReaderText.icon, 'text/html' ).body.firstElementChild;
|
||||
dropdownToggle.appendChild( icon);
|
||||
|
||||
// Add screenreader text.
|
||||
var screenReaderText = document.createElement( 'span' );
|
||||
screenReaderText.classList.add( 'screen-reader-text' );
|
||||
screenReaderText.textContent = trevilleScreenReaderText.expand;
|
||||
dropdownToggle.appendChild( screenReaderText );
|
||||
|
||||
return dropdownToggle.cloneNode(true);
|
||||
}
|
||||
|
||||
function initNavigation( containerClass, naviClass, menuToggleClass ) {
|
||||
var container = document.querySelector( containerClass );
|
||||
var navigation = document.querySelector( naviClass );
|
||||
|
||||
// Return early if navigation is missing.
|
||||
if ( navigation === null || container === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable menuToggle.
|
||||
(function() {
|
||||
var menuToggle = document.querySelector( menuToggleClass );
|
||||
|
||||
// Return early if menuToggle is missing.
|
||||
if ( menuToggle === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add an initial value for the attribute.
|
||||
menuToggle.setAttribute( 'aria-expanded', 'false' );
|
||||
|
||||
// Menu Toggle click event.
|
||||
menuToggle.addEventListener( 'click', function() {
|
||||
container.classList.toggle( 'toggled-on' );
|
||||
menuToggle.setAttribute( 'aria-expanded', container.classList.contains( 'toggled-on' ) );
|
||||
});
|
||||
})();
|
||||
|
||||
// Enable dropdownToggles that displays child menu items.
|
||||
(function() {
|
||||
|
||||
// Insert dropdown toggles in navigation menu.
|
||||
navigation.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ).forEach( function( menuItem ) {
|
||||
menuItem.after( createDropdownToggle() );
|
||||
});
|
||||
|
||||
// Set the active submenu dropdown toggle button initial state.
|
||||
navigation.querySelectorAll( '.current-menu-ancestor > button' ).forEach( function( activeToggle ) {
|
||||
activeToggle.classList.add( 'toggled-on' );
|
||||
activeToggle.setAttribute( 'aria-expanded', 'true' );
|
||||
activeToggle.querySelector( '.screen-reader-text' ).textContent = trevilleScreenReaderText.collapse;
|
||||
});
|
||||
|
||||
// Set the active submenu initial state.
|
||||
navigation.querySelectorAll( '.current-menu-ancestor > .sub-menu' ).forEach( function( activeSubmenu ) {
|
||||
activeSubmenu.classList.add( 'toggled-on' );
|
||||
});
|
||||
|
||||
// Dropdown Toggles click events.
|
||||
navigation.querySelectorAll( '.dropdown-toggle' ).forEach( function( dropdownItem ) {
|
||||
dropdownItem.addEventListener( 'click', function() {
|
||||
dropdownItem.classList.toggle( 'toggled-on' );
|
||||
dropdownItem.setAttribute( 'aria-expanded', dropdownItem.classList.contains( 'toggled-on' ) );
|
||||
dropdownItem.querySelector( '.screen-reader-text' ).textContent = dropdownItem.classList.contains( 'toggled-on' ) ? trevilleScreenReaderText.collapse : trevilleScreenReaderText.expand;
|
||||
dropdownItem.nextElementSibling.classList.toggle( 'toggled-on' );
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
// Toggle focus class to allow keyboard navigation.
|
||||
(function() {
|
||||
|
||||
function toggleFocusClass( menuItem ) {
|
||||
|
||||
// Loop through all parent elements up to the menus root.
|
||||
var parent = menuItem.parentNode;
|
||||
while ( ! parent.classList.contains( 'menu' ) ) {
|
||||
|
||||
// Check if we pass any li elements which have submenus.
|
||||
if ( parent.classList.contains( 'menu-item-has-children' ) ) {
|
||||
parent.classList.toggle( 'focus' );
|
||||
}
|
||||
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
navigation.querySelectorAll( '.menu-item-has-children a, .page_item_has_children a' ).forEach( function( menuItem ) {
|
||||
menuItem.addEventListener( 'focus', function() {
|
||||
toggleFocusClass( menuItem );
|
||||
});
|
||||
menuItem.addEventListener( 'blur', function() {
|
||||
toggleFocusClass( menuItem );
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
||||
}
|
||||
|
||||
document.addEventListener( 'DOMContentLoaded', function() {
|
||||
|
||||
// Init Main Navigation.
|
||||
initNavigation( '.primary-navigation-wrap', '.main-navigation', '.mobile-menu-toggle' );
|
||||
|
||||
// Init Top Navigation.
|
||||
initNavigation( '.secondary-navigation', '.top-navigation', '.mobile-menu-toggle' );
|
||||
|
||||
} );
|
||||
|
||||
}() );
|
||||
23
assets/treville/js/slider.js
Executable file
23
assets/treville/js/slider.js
Executable file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Flexslider Setup
|
||||
*
|
||||
* Adds the Flexslider Plugin for the Featured Post Slideshow
|
||||
*
|
||||
* @package Treville
|
||||
*/
|
||||
|
||||
jQuery( document ).ready(function($) {
|
||||
|
||||
/* Add flexslider to #post-slider div */
|
||||
$( "#post-slider" ).flexslider({
|
||||
animation: treville_slider_params.animation,
|
||||
slideshowSpeed: treville_slider_params.speed,
|
||||
namespace: "zeeflex-",
|
||||
selector: ".zeeslides > li",
|
||||
smoothHeight: true,
|
||||
pauseOnHover: true,
|
||||
controlNav: false,
|
||||
controlsContainer: ".post-slider-controls"
|
||||
});
|
||||
|
||||
});
|
||||
230
assets/treville/js/svgxuse.js
Executable file
230
assets/treville/js/svgxuse.js
Executable file
@@ -0,0 +1,230 @@
|
||||
/*!
|
||||
* @copyright Copyright (c) 2017 IcoMoon.io
|
||||
* @license Licensed under MIT license
|
||||
* See https://github.com/Keyamoon/svgxuse
|
||||
* @version 1.2.6
|
||||
*/
|
||||
/*jslint browser: true */
|
||||
/*global XDomainRequest, MutationObserver, window */
|
||||
(function () {
|
||||
"use strict";
|
||||
if (typeof window !== "undefined" && window.addEventListener) {
|
||||
var cache = Object.create(null); // holds xhr objects to prevent multiple requests
|
||||
var checkUseElems;
|
||||
var tid; // timeout id
|
||||
var debouncedCheck = function () {
|
||||
clearTimeout(tid);
|
||||
tid = setTimeout(checkUseElems, 100);
|
||||
};
|
||||
var unobserveChanges = function () {
|
||||
return;
|
||||
};
|
||||
var observeChanges = function () {
|
||||
var observer;
|
||||
window.addEventListener("resize", debouncedCheck, false);
|
||||
window.addEventListener("orientationchange", debouncedCheck, false);
|
||||
if (window.MutationObserver) {
|
||||
observer = new MutationObserver(debouncedCheck);
|
||||
observer.observe(document.documentElement, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
attributes: true
|
||||
});
|
||||
unobserveChanges = function () {
|
||||
try {
|
||||
observer.disconnect();
|
||||
window.removeEventListener("resize", debouncedCheck, false);
|
||||
window.removeEventListener("orientationchange", debouncedCheck, false);
|
||||
} catch (ignore) {}
|
||||
};
|
||||
} else {
|
||||
document.documentElement.addEventListener("DOMSubtreeModified", debouncedCheck, false);
|
||||
unobserveChanges = function () {
|
||||
document.documentElement.removeEventListener("DOMSubtreeModified", debouncedCheck, false);
|
||||
window.removeEventListener("resize", debouncedCheck, false);
|
||||
window.removeEventListener("orientationchange", debouncedCheck, false);
|
||||
};
|
||||
}
|
||||
};
|
||||
var createRequest = function (url) {
|
||||
// In IE 9, cross origin requests can only be sent using XDomainRequest.
|
||||
// XDomainRequest would fail if CORS headers are not set.
|
||||
// Therefore, XDomainRequest should only be used with cross origin requests.
|
||||
function getOrigin(loc) {
|
||||
var a;
|
||||
if (loc.protocol !== undefined) {
|
||||
a = loc;
|
||||
} else {
|
||||
a = document.createElement("a");
|
||||
a.href = loc;
|
||||
}
|
||||
return a.protocol.replace(/:/g, "") + a.host;
|
||||
}
|
||||
var Request;
|
||||
var origin;
|
||||
var origin2;
|
||||
if (window.XMLHttpRequest) {
|
||||
Request = new XMLHttpRequest();
|
||||
origin = getOrigin(location);
|
||||
origin2 = getOrigin(url);
|
||||
if (Request.withCredentials === undefined && origin2 !== "" && origin2 !== origin) {
|
||||
Request = XDomainRequest || undefined;
|
||||
} else {
|
||||
Request = XMLHttpRequest;
|
||||
}
|
||||
}
|
||||
return Request;
|
||||
};
|
||||
var xlinkNS = "http://www.w3.org/1999/xlink";
|
||||
checkUseElems = function () {
|
||||
var base;
|
||||
var bcr;
|
||||
var fallback = ""; // optional fallback URL in case no base path to SVG file was given and no symbol definition was found.
|
||||
var hash;
|
||||
var href;
|
||||
var i;
|
||||
var inProgressCount = 0;
|
||||
var isHidden;
|
||||
var Request;
|
||||
var url;
|
||||
var uses;
|
||||
var xhr;
|
||||
function observeIfDone() {
|
||||
// If done with making changes, start watching for chagnes in DOM again
|
||||
inProgressCount -= 1;
|
||||
if (inProgressCount === 0) { // if all xhrs were resolved
|
||||
unobserveChanges(); // make sure to remove old handlers
|
||||
observeChanges(); // watch for changes to DOM
|
||||
}
|
||||
}
|
||||
function attrUpdateFunc(spec) {
|
||||
return function () {
|
||||
if (cache[spec.base] !== true) {
|
||||
spec.useEl.setAttributeNS(xlinkNS, "xlink:href", "#" + spec.hash);
|
||||
if (spec.useEl.hasAttribute("href")) {
|
||||
spec.useEl.setAttribute("href", "#" + spec.hash);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function onloadFunc(xhr) {
|
||||
return function () {
|
||||
var body = document.body;
|
||||
var x = document.createElement("x");
|
||||
var svg;
|
||||
xhr.onload = null;
|
||||
x.innerHTML = xhr.responseText;
|
||||
svg = x.getElementsByTagName("svg")[0];
|
||||
if (svg) {
|
||||
svg.setAttribute("aria-hidden", "true");
|
||||
svg.style.position = "absolute";
|
||||
svg.style.width = 0;
|
||||
svg.style.height = 0;
|
||||
svg.style.overflow = "hidden";
|
||||
body.insertBefore(svg, body.firstChild);
|
||||
}
|
||||
observeIfDone();
|
||||
};
|
||||
}
|
||||
function onErrorTimeout(xhr) {
|
||||
return function () {
|
||||
xhr.onerror = null;
|
||||
xhr.ontimeout = null;
|
||||
observeIfDone();
|
||||
};
|
||||
}
|
||||
unobserveChanges(); // stop watching for changes to DOM
|
||||
// find all use elements
|
||||
uses = document.getElementsByTagName("use");
|
||||
for (i = 0; i < uses.length; i += 1) {
|
||||
try {
|
||||
bcr = uses[i].getBoundingClientRect();
|
||||
} catch (ignore) {
|
||||
// failed to get bounding rectangle of the use element
|
||||
bcr = false;
|
||||
}
|
||||
href = uses[i].getAttribute("href")
|
||||
|| uses[i].getAttributeNS(xlinkNS, "href")
|
||||
|| uses[i].getAttribute("xlink:href");
|
||||
if (href && href.split) {
|
||||
url = href.split("#");
|
||||
} else {
|
||||
url = ["", ""];
|
||||
}
|
||||
base = url[0];
|
||||
hash = url[1];
|
||||
isHidden = bcr && bcr.left === 0 && bcr.right === 0 && bcr.top === 0 && bcr.bottom === 0;
|
||||
if (bcr && bcr.width === 0 && bcr.height === 0 && !isHidden) {
|
||||
// the use element is empty
|
||||
// if there is a reference to an external SVG, try to fetch it
|
||||
// use the optional fallback URL if there is no reference to an external SVG
|
||||
if (fallback && !base.length && hash && !document.getElementById(hash)) {
|
||||
base = fallback;
|
||||
}
|
||||
if (uses[i].hasAttribute("href")) {
|
||||
uses[i].setAttributeNS(xlinkNS, "xlink:href", href);
|
||||
}
|
||||
if (base.length) {
|
||||
// schedule updating xlink:href
|
||||
xhr = cache[base];
|
||||
if (xhr !== true) {
|
||||
// true signifies that prepending the SVG was not required
|
||||
setTimeout(attrUpdateFunc({
|
||||
useEl: uses[i],
|
||||
base: base,
|
||||
hash: hash
|
||||
}), 0);
|
||||
}
|
||||
if (xhr === undefined) {
|
||||
Request = createRequest(base);
|
||||
if (Request !== undefined) {
|
||||
xhr = new Request();
|
||||
cache[base] = xhr;
|
||||
xhr.onload = onloadFunc(xhr);
|
||||
xhr.onerror = onErrorTimeout(xhr);
|
||||
xhr.ontimeout = onErrorTimeout(xhr);
|
||||
xhr.open("GET", base);
|
||||
xhr.send();
|
||||
inProgressCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!isHidden) {
|
||||
if (cache[base] === undefined) {
|
||||
// remember this URL if the use element was not empty and no request was sent
|
||||
cache[base] = true;
|
||||
} else if (cache[base].onload) {
|
||||
// if it turns out that prepending the SVG is not necessary,
|
||||
// abort the in-progress xhr.
|
||||
cache[base].abort();
|
||||
delete cache[base].onload;
|
||||
cache[base] = true;
|
||||
}
|
||||
} else if (base.length && cache[base]) {
|
||||
setTimeout(attrUpdateFunc({
|
||||
useEl: uses[i],
|
||||
base: base,
|
||||
hash: hash
|
||||
}), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
uses = "";
|
||||
inProgressCount += 1;
|
||||
observeIfDone();
|
||||
};
|
||||
var winLoad;
|
||||
winLoad = function () {
|
||||
window.removeEventListener("load", winLoad, false); // to prevent memory leaks
|
||||
tid = setTimeout(checkUseElems, 0);
|
||||
};
|
||||
if (document.readyState !== "complete") {
|
||||
// The load event fires when all resources have finished loading, which allows detecting whether SVG use elements are empty.
|
||||
window.addEventListener("load", winLoad, false);
|
||||
} else {
|
||||
// No need to add a listener if the document is already loaded, initialize immediately.
|
||||
winLoad();
|
||||
}
|
||||
}
|
||||
}());
|
||||
Reference in New Issue
Block a user