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
// See: http://blogs.adobe.com/experiencedelivers/experience-management/htl-intro-part-3/ | |
<!--/* Accessing a value */--> | |
${properties['jcr:title']} | |
<!--/* Printing an array */--> | |
${aemComponent.names} | |
<!--/* Printing the array, separating items by ; */--> | |
${aemComponent.names @ 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
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | |
var dataAttributes = document.querySelector('elementIdentifier').dataset; |
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
/** | |
* Ensure that target page exists before we actually do something. | |
* | |
* @param {string} targetUrl - Absolute target URL to be tested | |
* @param {function} [successCallback] - Function to be executed on success | |
* @param {function} [failCallback] - Function to be executed on fail | |
*/ | |
function checkTargetFirst(targetUrl, successCallback, failCallback) { | |
var reader = new XMLHttpRequest(); |
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
#! /bin/bash | |
# https://www.npmjs.com/package/aemsync | |
# Usage: Run `$ sh aemsync.sh` in your terminal from the folder where this script is located. | |
if ! type "aemsync" > /dev/null; | |
then | |
echo "aemsync is not installed. Installing..." | |
sudo npm install aemsync -g | |
fi |
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
#! /bin/bash | |
# https://www.npmjs.com/package/browser-sync | |
# Documentation: https://browsersync.io/docs/command-line | |
# Usage: Run `$ sh browsersync.sh` in your terminal from the folder where this script is located. | |
# Use this script together with https://github.com/kevinweber/aem-front-extension | |
if ! type "browser-sync" > /dev/null; | |
then | |
echo "browser-sync is not installed. Installing..." | |
sudo npm install browser-sync -g |
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
$('#textareaID').on('input change keyup', function () { | |
if (this.value.length) { | |
// textarea has content | |
} else { | |
// textarea is empty | |
} | |
}); |
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
/** | |
* Sort objects of an object based on one of their common properties | |
* | |
* Call it like this: | |
* mySortedObject = sortObjectWithObjects(myObject, "name"); | |
* | |
* To store ... | |
* | |
var myObject = [{ |
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
/*global jQuery */ | |
/** | |
* $.responsiveVideo | |
* by Kevin Weber | |
* | |
* Improve responsiveness of videos. | |
* Libraries required: jQuery. | |
* | |
* Initiate plugin like this: |
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
/** | |
* Move element's class to parent element | |
* Usage example: | |
* $element.moveClassToParent('select-container'); | |
*/ | |
(function ($) { | |
"use strict"; | |
// Create the defaults once |
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
/** | |
* Loop through an object and call a passed function | |
*/ | |
function loopObject(object, func) { | |
var property; | |
for (property in object) { | |
if (object.hasOwnProperty(property)) { | |
func(property, object); | |
} |