Skip to content

Instantly share code, notes, and snippets.

@rbackhouse
rbackhouse / amdcalendar.html
Created January 15, 2012 14:20
HTML Resource with script embedded zazl reference
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@import "dojo/resources/dojo.css";
@import "dijit/themes/claro/claro.css";
</style>
<script type="text/javascript">
var dojoConfig = {
@rbackhouse
rbackhouse / Calendar.js
Created October 23, 2011 15:39
Calendar AMD module
define([
'dojo',
'dijit/Calendar',
'dojo/domReady!'
], function (dojo, Calendar) {
var calendar = new Calendar({}, dojo.byId("calendarNode"));
return calendar;
});
@rbackhouse
rbackhouse / amdcalendar.jsp
Created October 23, 2011 15:38
JSP Example using the Zazl AMD Optimizer
<%@ page import="org.dojotoolkit.optimizer.JSOptimizer" %>
<%@ page import="org.dojotoolkit.optimizer.servlet.JSURLGenerator" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@import "lib/dojo/resources/dojo.css";
@import "lib/dijit/themes/claro/claro.css";
</style>
@rbackhouse
rbackhouse / calendar.jsp
Created September 11, 2011 13:57
JSP Example using the Zazl Syncloader Optimizer
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="org.dojotoolkit.optimizer.JSOptimizer" %>
<%@ page import="org.dojotoolkit.optimizer.servlet.JSURLGenerator" %>
<html>
<head>
<title>Calendar</title>
<style type="text/css">
@import "<%=request.getContextPath()%>/dojo/resources/dojo.css";
</style>
<link id="themeStyles" rel="stylesheet" href="<%=request.getContextPath()%>/dijit/themes/claro/claro.css"/>
@rbackhouse
rbackhouse / optimizer.jsp
Created June 11, 2011 11:47
Example JSP showing calling the JS Optimizer API
<%@ page import="org.dojotoolkit.optimizer.JSOptimizer" %>
<%@ page import="org.dojotoolkit.optimizer.JSAnalysisData" %>
<script type="text/javascript">
djConfig = {
isDebug: false,
usePlainJson: true,
parseOnLoad: true,
baseUrl: "<%=request.getContextPath()%>/dojo/",
locale: "<%=request.getLocale().toString().toLowerCase().replace('_', '-')%>",
@rbackhouse
rbackhouse / web.xml
Created June 11, 2011 11:40
Required web.xml configuration for the Zazl JS Optimizer
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>javaChecksum</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>compressJS</param-name>
<param-value>true</param-value>
</context-param>
@rbackhouse
rbackhouse / mystandard.profile.js
Created June 11, 2011 11:36
Custom Dojo build profile that can be used with the Zazl JS optimizer
dependencies = {
stripConsole: "normal",
layers: [
],
prefixes: [
[ "dijit", "../dijit" ],
[ "dojox", "../dojox" ]
]
@rbackhouse
rbackhouse / MultiRootResourceLoader.java
Created March 26, 2011 11:09
A Multiple Rooted Resource Loader
import java.io.File;
import java.io.IOException;
import java.net.URL;
import org.dojotoolkit.compressor.JSCompressorFactory;
import org.dojotoolkit.compressor.JSCompressorResourceLoader;
public class MultiRootResourceLoader extends JSCompressorResourceLoader {
private File[] roots = null;
@rbackhouse
rbackhouse / RhinoCommonJSLoader.java
Created March 24, 2011 01:31
Example demonstrating calling the commonjs loader via Rhino
import java.io.IOException;
import org.dojotoolkit.server.util.resource.ResourceLoader;
import org.dojotoolkit.server.util.rhino.RhinoClassLoader;
import org.dojotoolkit.server.util.rhino.RhinoJSMethods;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ScriptableObject;
public class RhinoCommonJSLoader {
private RhinoClassLoader rhinoClassLoader = null;
private ResourceLoader resourceLoader = null;
@rbackhouse
rbackhouse / V8CommonJSLoader.java
Created March 24, 2011 01:30
Example demonstrating calling the commonjs loader via V8
import java.io.IOException;
import org.dojotoolkit.rt.v8.V8JavaBridge;
import org.dojotoolkit.server.util.resource.ResourceLoader;
public class V8CommonJSLoader extends V8JavaBridge {
private ResourceLoader resourceLoader = null;
public V8CommonJSLoader(ResourceLoader resourceLoader) {
super(true);
this.resourceLoader = resourceLoader;