Skip to content

Instantly share code, notes, and snippets.

@rogerblanton
rogerblanton / modal-rte-plugin.js
Created June 15, 2018 06:06
A plugin that allows you to author modals based on Bootstrap 3 in AEM RTE.
(function ($) {
"use strict";
// Setup Constants
var modalPlugin = {
GROUP: "modalPlugin",
DEBUG: true,
FEATURE: "modal",
MODAL_DIALOG: "modaldialog",
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
background: repeat url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/7QCIUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGscAVoAAxslRxwCAAACAAAcAnQAV8KpIENoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbGQgLSBodHRwOi8vd3d3LnJlZGJ1YmJsZS5jb20vcGVvcGxlL0NoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAA
@rogerblanton
rogerblanton / color-picker-rte-plugin.js
Created June 15, 2018 01:25
Sample Color Picker Plugin that uses an Iframe to render a dialog instead of native Coral UI fields.
(function($, CUI){
var GROUP = "experience-aem",
COLOR_PICKER_FEATURE = "colorPicker",
TCP_DIALOG = "eaemTouchUIColorPickerDialog",
PICKER_NAME_IN_POPOVER = "color",
REQUESTER = "requester",
PICKER_URL = "/apps/eaem-touchui-dialog-rte-color-picker/color-picker-popover/cq:dialog.html";
addPluginToDefaultUISettings();
package com.adobe.example;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
import org.apache.felix.scr.annotations.Property;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
@rogerblanton
rogerblanton / .bash_aliases
Last active May 28, 2016 12:23
Make Terminal Better
alias reloadpr="source ~/.profile"
alias cp="cp -iv"
alias mv="mv -iv"
alias ls='ls -GFh'
alias ll='ls -FGhlAp'
# Directory Navigation
alias sites='cd ~/Sites'
alias ..="cd ../"
alias ...="cd ../../"
@rogerblanton
rogerblanton / share-count.md
Last active May 26, 2016 17:33
Share Count APIs

Share Counts

Twitter

GET URL:

http://cdn.api.twitter.com/1/urls/count.json?url=http://blantonmedia.com

@rogerblanton
rogerblanton / com.day.cq.commons.servlets.RootMappingServlet.xml
Last active May 26, 2016 17:06
Change the default start page of AEM 5.6+ from touch ui to classic interface
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
rootmapping.target="/welcome"/>
{
"fonts.fontSize": "14px",
"fonts.fontFamily": "'Monaco'",
"linting.collapsed": true,
"useTabChar": true,
"tabSize": 2,
"themes.theme": "dark_soda_theme"
}
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
@rogerblanton
rogerblanton / init-fix.jsp
Created July 23, 2014 18:36
When using sling to include CQ pages inside another CQ page, the init.jsp script will try to fire multiple times and the sidekick rendering will not work properly, instead check to see if the page you are reviewing is the actual page and use init.jsp to render sidekick, or if you are viewing it embedded in another page, disabled the init.jsp call
<%@include file="/myapp/includes/base-global.jsp" %>
<!-- Load sidekick only when viewing page on its own -->
<% if(currentPage.getPath().equals(resourcePage.getPath())) { %>
<cq:include script="/libs/wcm/core/components/init/init.jsp"/>
<% } %>