-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
70 changed files
with
4,747 additions
and
516 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,116 @@ | ||
var taprootFooter=document.querySelector(".app-footer");if(taprootFooter.classList.contains("app-footer--has-fixed")){var taprootFooterObserver=new ResizeObserver(function(){window.dispatchEvent(new Event("resize"))});taprootFooterObserver.observe(taprootFooter)}function taprootFontStyles(e){var t=e.split("|"),r={},n=jQuery.noConflict();return 0<=n.inArray("bold",t)&&(r["font-weight"]="bold"),0<=n.inArray("italic",t)&&(r["font-style"]="italic"),0<=n.inArray("underline",t)&&(r["text-decoration"]="underline"),0<=n.inArray("uppercase",t)?r["text-transform"]="uppercase":0<=n.inArray("capitalize",t)&&(r["text-transform"]="capitalize"),r}function getFontFamily(e){return"default"!==e&&e?e.includes('"')?e:'"'+e+'"':"unset"}function getMobileScreen(e="default"){return"never"!==e&&e}function getDesktopScreen(e="default"){var t={never:"default",mobile:"tablet-and-up","tablet-and-under":"desktop",always:!1};return!!t[e]&&t[e]}function getPaddingFromWidth(e,t=!1){var r=(100-(e=e.replace(/[^0-9]/g,"")))/2;return t&&(r+=t),r}function maybeConvertToEm(e){return!!e&&(e.includes("px")||e.includes("%")||e.includes("em")?e:e+"em")} | ||
/** | ||
* Fixed Footer Monitor | ||
* | ||
* This file handles the JavaScript for detecting changes in the height | ||
* of the footer when "fixed footer" is enabled. This currently only works | ||
* in Chrome. There is a polyfill, that can be added for advanced support. | ||
* | ||
* @package Taproot | ||
* @author Sky Shabatura <[email protected]> | ||
* @copyright 2020 Sky Shabatura | ||
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later | ||
* @link https://taproot-theme.com | ||
*/ | ||
var taprootFooter = document.querySelector('.app-footer'); | ||
if (taprootFooter.classList.contains('app-footer--has-fixed')) { | ||
var taprootFooterObserver = new ResizeObserver(function () { | ||
window.dispatchEvent(new Event('resize')); | ||
}); | ||
taprootFooterObserver.observe(taprootFooter); | ||
} | ||
|
||
/** | ||
* Utility functions for use in customize preview js. | ||
* | ||
* @package Taproot | ||
* @author Sky Shabatura <[email protected]> | ||
* @copyright 2020 Sky Shabatura | ||
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later | ||
*/ | ||
|
||
// Build font style from our font style control values. | ||
function taprootFontStyles( value ) { | ||
value = value.split( '|' ); | ||
let styles = {}; | ||
|
||
styles['font-weight'] = ( value.includes( 'bold' ) ) ? 'bold' : 'normal'; | ||
styles['font-style'] = ( value.includes( 'italic' ) ) ? 'italic' : 'normal'; | ||
styles['text-decoration'] = ( value.includes( 'underline' ) ) ? 'underline' : 'none'; | ||
|
||
if( value.includes( 'uppercase' ) ) { | ||
styles['text-transform'] = 'uppercase'; | ||
} | ||
else if( value.includes( 'capitalize' ) ) { | ||
styles['text-transform'] = 'capitalize'; | ||
} | ||
else { | ||
styles['text-transform'] = 'none'; | ||
} | ||
|
||
return styles; | ||
} | ||
|
||
// Get font family. | ||
// Adds quotes if needed. Checks if "default" is set, and returns unset if so. | ||
function getFontFamily( font ) { | ||
|
||
if( 'default' === font || ! font ) { | ||
return 'unset'; | ||
} | ||
else if( font.includes( '"' ) ) { | ||
return font; | ||
} | ||
else { | ||
return '"' + font + '"'; | ||
} | ||
} | ||
|
||
// Get mobile screen from setting value. | ||
function getMobileScreen( screen = 'default' ) { | ||
return ( 'never' === screen ) ? false : screen; | ||
} | ||
|
||
// Get Desktop screen from mobile setting value. | ||
function getDesktopScreen( screen = 'default' ) { | ||
|
||
var screens = { | ||
'never': 'default', | ||
'mobile': 'tablet-and-up', | ||
'tablet-and-under': 'desktop', | ||
'always': false | ||
}; | ||
|
||
return ( screens[screen] ) ? screens[screen] : false; | ||
} | ||
|
||
// Calculate padding from a width. | ||
function getPaddingFromWidth( width, unit = false ) { | ||
|
||
width = width.replace(/[^0-9]/g,''); | ||
var padding = (100 - width) / 2; | ||
|
||
if( unit ) { | ||
padding += unit; | ||
} | ||
|
||
return padding; | ||
} | ||
|
||
// Maybe convert unitless value to em? | ||
function maybeConvertToEm( value ) { | ||
|
||
// If nothing is set, bail | ||
if( ! value ) { | ||
return false; | ||
} | ||
|
||
// If a unit is set, return value | ||
if( value.includes( 'px' ) || value.includes( '%' ) || value.includes( 'em' ) ) { | ||
return value; | ||
} | ||
|
||
// Otherwise, add 'em' | ||
else { | ||
return value + 'em'; | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"/dist/js/app.js": "/dist/js/app.js?id=4aae7780209050c34139", | ||
"/dist/css/theme.css": "/dist/css/theme.css?id=abf45862c4090fa66218", | ||
"/dist/css/editor.css": "/dist/css/editor.css?id=f0d5c152e7698b659101", | ||
"/dist/css/customize-controls.css": "/dist/css/customize-controls.css?id=2513101c36a23706437e", | ||
"/dist/js/app.js.map": "/dist/js/app.js.map?id=a3fd42acabb780318690", | ||
"/dist/css/theme.css.map": "/dist/css/theme.css.map?id=2de0adf8bb070dd5bff2", | ||
"/dist/css/editor.css.map": "/dist/css/editor.css.map?id=d3dd28c687efcae96d48", | ||
"/dist/css/customize-controls.css.map": "/dist/css/customize-controls.css.map?id=03552549776a680d4072", | ||
"/dist/js/customize-controls.js": "/dist/js/customize-controls.js?id=dd126f33dda7bbe4e303", | ||
"/dist/js/customize-controls.js.map": "/dist/js/customize-controls.js.map?id=27ccf3d23c1e1b960d42", | ||
"/dist/js/editor.js": "/dist/js/editor.js?id=cfdd34af741a35cb8d02", | ||
"/dist/js/editor.js.map": "/dist/js/editor.js.map?id=bb1f515357f4df678fc6", | ||
"/dist/js/customize-preview.js": "/dist/js/customize-preview.js?id=3688fb6519809dc80bd8" | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Multicheck | ||
* | ||
* This file handles the JavaScript for the multicheck customizer control. | ||
* | ||
* @package Taproot | ||
* @author Sky Shabatura <[email protected]> | ||
* @copyright 2020 Sky Shabatura | ||
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later | ||
*/ | ||
|
||
class Multicheck { | ||
|
||
constructor() { | ||
this.handlers(); | ||
} | ||
|
||
handlers() { | ||
|
||
document.querySelectorAll( '.customize-control-checkbox-multiple input[type="checkbox"]' ).forEach( cb => { | ||
cb.addEventListener('change', (e) => { | ||
const $this = e.target; | ||
const control = $this.closest('.customize-control'); | ||
const checked = control.querySelectorAll( 'input[type="checkbox"]:checked' ); | ||
const input = control.querySelector( 'input[type="hidden"]' ); | ||
var list = []; | ||
|
||
checked.forEach( check => { | ||
list.push( check.value ); | ||
}); | ||
|
||
input.value = list.join(); | ||
input.dispatchEvent( new Event('change') ); | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Run on document ready | ||
*/ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const multicheck = new Multicheck(); | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
/** | ||
* Primary front-end script. | ||
* Editor script. | ||
* | ||
* Primary JavaScript file. Any includes or anything imported should | ||
* be filtered through this file and eventually saved back into the | ||
* `/dist/js/app.js` file. | ||
* Primary JavaScript file for theme editor functionality. | ||
* | ||
* @package Taproot | ||
* @author Sky Shabatura <[email protected]> | ||
|
@@ -12,6 +10,4 @@ | |
* @link https://taproot-theme.com | ||
*/ | ||
|
||
|
||
import './editor/sidebar/index.js'; | ||
import './editor/blocks/buttons/index.js'; |
Oops, something went wrong.