Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

The mootools-amq.js and a sample. Run in Jetty.

  • Loading branch information...
commit b79458a0e45dfc63a525ed612e28985de5e47612 1 parent c4b8159
Dani authored
74 pom.xml
... ... @@ -0,0 +1,74 @@
  1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3 + <modelVersion>4.0.0</modelVersion>
  4 + <groupId>mootools-amq</groupId>
  5 + <artifactId>mootools-amq</artifactId>
  6 + <packaging>war</packaging>
  7 + <version>1.0</version>
  8 + <name>MooTools ActiveMQ integration plus sample</name>
  9 + <url>http://maven.apache.org</url>
  10 + <dependencies>
  11 + <dependency>
  12 + <groupId>javax.servlet</groupId>
  13 + <artifactId>jstl</artifactId>
  14 + <version>1.2</version>
  15 + </dependency>
  16 + <dependency>
  17 + <groupId>org.springframework</groupId>
  18 + <artifactId>spring-webmvc</artifactId>
  19 + <version>3.1.0.RELEASE</version>
  20 + </dependency>
  21 + <dependency>
  22 + <groupId>org.springframework</groupId>
  23 + <artifactId>spring-jms</artifactId>
  24 + <version>3.1.0.RELEASE</version>
  25 + </dependency>
  26 + <dependency>
  27 + <groupId>org.apache.activemq</groupId>
  28 + <artifactId>activemq-web</artifactId>
  29 + <version>5.5.1</version>
  30 + <exclusions>
  31 + <exclusion>
  32 + <groupId>javax.servlet</groupId>
  33 + <artifactId>servlet-api</artifactId>
  34 + </exclusion>
  35 + <exclusion>
  36 + <groupId>org.eclipse.jetty</groupId>
  37 + <artifactId>jetty-continuation</artifactId>
  38 + </exclusion>
  39 + <exclusion>
  40 + <groupId>org.eclipse.jetty</groupId>
  41 + <artifactId>jetty-server</artifactId>
  42 + </exclusion>
  43 + <exclusion>
  44 + <groupId>org.eclipse.jetty</groupId>
  45 + <artifactId>jetty-websocket</artifactId>
  46 + </exclusion>
  47 + </exclusions>
  48 + </dependency>
  49 + <dependency>
  50 + <groupId>log4j</groupId>
  51 + <artifactId>log4j</artifactId>
  52 + <version>1.2.16</version>
  53 + </dependency>
  54 + <dependency>
  55 + <groupId>org.slf4j</groupId>
  56 + <artifactId>slf4j-api</artifactId>
  57 + <version>1.6.4</version>
  58 + </dependency>
  59 + <dependency>
  60 + <groupId>org.slf4j</groupId>
  61 + <artifactId>slf4j-log4j12</artifactId>
  62 + <version>1.6.4</version>
  63 + </dependency>
  64 + <dependency>
  65 + <groupId>junit</groupId>
  66 + <artifactId>junit</artifactId>
  67 + <version>4.10</version>
  68 + <scope>test</scope>
  69 + </dependency>
  70 + </dependencies>
  71 + <build>
  72 + <finalName>mootools-amq</finalName>
  73 + </build>
  74 +</project>
90 src/main/java/org/sample/TimeController.java
... ... @@ -0,0 +1,90 @@
  1 +/**
  2 + *
  3 + * Licensed to the Apache Software Foundation (ASF) under one or more
  4 + * contributor license agreements. See the NOTICE file distributed with
  5 + * this work for additional information regarding copyright ownership.
  6 + * The ASF licenses this file to You under the Apache License, Version 2.0
  7 + * (the "License"); you may not use this file except in compliance with
  8 + * the License. You may obtain a copy of the License at
  9 + *
  10 + * http://www.apache.org/licenses/LICENSE-2.0
  11 + *
  12 + * Unless required by applicable law or agreed to in writing, software
  13 + * distributed under the License is distributed on an "AS IS" BASIS,
  14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 + * See the License for the specific language governing permissions and
  16 + * limitations under the License.
  17 + */
  18 +
  19 +package org.sample;
  20 +
  21 +import org.slf4j.Logger;
  22 +import org.slf4j.LoggerFactory;
  23 +import org.springframework.beans.factory.annotation.Autowired;
  24 +import org.springframework.stereotype.Controller;
  25 +import org.springframework.web.bind.annotation.RequestMapping;
  26 +import org.springframework.web.bind.annotation.RequestMethod;
  27 +import org.springframework.web.servlet.ModelAndView;
  28 +
  29 +import javax.jms.*;
  30 +import java.math.BigInteger;
  31 +import java.security.SecureRandom;
  32 +import java.text.SimpleDateFormat;
  33 +import java.util.Date;
  34 +import java.util.Timer;
  35 +import java.util.TimerTask;
  36 +
  37 +@Controller
  38 +public class TimeController {
  39 + private final Logger log = LoggerFactory.getLogger(TimeController.class);
  40 + @Autowired
  41 + private ConnectionFactory jmsFactory;
  42 +
  43 + @RequestMapping(method = RequestMethod.GET, value = {"/tick"})
  44 + public ModelAndView get() throws Exception {
  45 + Connection connection = jmsFactory.createConnection();
  46 + Session jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
  47 + SecureRandom srandom = new SecureRandom();
  48 + String rand = new BigInteger(176, srandom).toString(32);
  49 + String q = Long.toString(System.currentTimeMillis()) + "-" + rand;
  50 + Destination destination = jmsSession.createQueue(q);
  51 +
  52 + Timer timer = new Timer();
  53 + long delay = 1*1000;
  54 + timer.schedule(new TickTask(jmsSession, destination), 0, delay);
  55 +
  56 + ModelAndView mav = new ModelAndView("client");
  57 + mav.addObject("queue", destination.toString());
  58 + return mav;
  59 + }
  60 +
  61 + private class TickTask extends TimerTask {
  62 +
  63 + private Destination destination;
  64 + private Session session;
  65 + private MessageProducer producer;
  66 +
  67 + TickTask(Session s, Destination d) throws JMSException {
  68 + this.destination = d;
  69 + this.session = s;
  70 + this.producer = session.createProducer(destination);
  71 + producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
  72 + }
  73 +
  74 + @Override
  75 + public void run() {
  76 +
  77 + Date date = new Date();
  78 + SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss");
  79 + String current_time = format.format(date);
  80 + log.info("Destination : " + destination.toString() + ", time : " + current_time);
  81 + try {
  82 + TextMessage message = session.createTextMessage(current_time);
  83 + producer.send(message);
  84 + } catch (JMSException e) {
  85 + e.printStackTrace();
  86 + }
  87 +
  88 + }
  89 + }
  90 +}
28 src/main/webapp/WEB-INF/jsp/client.jsp
... ... @@ -0,0 +1,28 @@
  1 +<%@ page contentType="text/html;charset=UTF-8" %>
  2 +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  3 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
  4 +<!DOCTYPE html>
  5 +<html>
  6 +<head>
  7 + <meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
  8 + <meta http-equiv="Pragma" content="no-cache">
  9 + <meta http-equiv="Cache-Control" content="no-cache">
  10 + <meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">
  11 + <title>MooTools AMQ</title>
  12 + <link rel="stylesheet" href="css/site.css" type="text/css"/>
  13 + <script src="js/mootools-core-1.4.2-full-nocompat.js" type="text/javascript"></script>
  14 + <script src="js/mootools-amq.js" type="text/javascript"></script>
  15 + <script src="js/app.js" type="text/javascript"></script>
  16 + <script>
  17 + var queue = "${queue}";
  18 + </script>
  19 +</head>
  20 +<div>
  21 + Queue: ${queue}
  22 +</div>
  23 +<div>
  24 + <span id="time"></span>
  25 +</div>
  26 +<body>
  27 +</body>
  28 +</html>
28 src/main/webapp/WEB-INF/spring-context.xml
... ... @@ -0,0 +1,28 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<beans xmlns="http://www.springframework.org/schema/beans"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xmlns:context="http://www.springframework.org/schema/context"
  5 + xmlns:mvc="http://www.springframework.org/schema/mvc"
  6 + xmlns:amq="http://activemq.apache.org/schema/core"
  7 + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  8 + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
  9 + http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
  10 + http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
  11 +
  12 + <context:annotation-config/>
  13 + <context:component-scan base-package="org.sample"/>
  14 + <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
  15 + <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
  16 + <mvc:resources mapping="/js/**" location="/js/"/>
  17 + <mvc:resources mapping="/css/**" location="/css/"/>
  18 +
  19 + <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  20 + <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
  21 + <property name="prefix" value="/WEB-INF/jsp/"/>
  22 + <property name="suffix" value=".jsp"/>
  23 + </bean>
  24 +
  25 + <!-- JMS ConnectionFactory to use, configuring the embedded broker using XML -->
  26 + <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>
  27 +
  28 +</beans>
42 src/main/webapp/WEB-INF/web.xml
... ... @@ -0,0 +1,42 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  5 +
  6 + <display-name>MooTools - AMQ Sample</display-name>
  7 +
  8 + <context-param>
  9 + <param-name>org.apache.activemq.brokerURL</param-name>
  10 + <param-value>vm://localhost</param-value>
  11 + </context-param>
  12 +
  13 + <context-param>
  14 + <param-name>org.apache.activemq.embeddedBroker</param-name>
  15 + <param-value>true</param-value>
  16 + </context-param>
  17 +
  18 + <servlet>
  19 + <servlet-name>AjaxServlet</servlet-name>
  20 + <servlet-class>org.apache.activemq.web.AjaxServlet</servlet-class>
  21 + <load-on-startup>1</load-on-startup>
  22 + </servlet>
  23 + <servlet-mapping>
  24 + <servlet-name>AjaxServlet</servlet-name>
  25 + <url-pattern>/amq/*</url-pattern>
  26 + </servlet-mapping>
  27 +
  28 + <servlet>
  29 + <servlet-name>spring</servlet-name>
  30 + <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  31 + <init-param>
  32 + <param-name>contextConfigLocation</param-name>
  33 + <param-value>WEB-INF/spring-context.xml</param-value>
  34 + </init-param>
  35 + <load-on-startup>1</load-on-startup>
  36 + </servlet>
  37 + <servlet-mapping>
  38 + <servlet-name>spring</servlet-name>
  39 + <url-pattern>/</url-pattern>
  40 + </servlet-mapping>
  41 +
  42 +</web-app>
446 src/main/webapp/css/site.css
... ... @@ -0,0 +1,446 @@
  1 +/*! normalize.css 2012-01-17T16:33 UTC - http://github.com/necolas/normalize.css */
  2 +
  3 +/* =============================================================================
  4 + HTML5 display definitions
  5 + ========================================================================== */
  6 +
  7 +/*
  8 + * Corrects block display not defined in IE6/7/8/9 & FF3
  9 + */
  10 +
  11 +article,
  12 +aside,
  13 +details,
  14 +figcaption,
  15 +figure,
  16 +footer,
  17 +header,
  18 +hgroup,
  19 +nav,
  20 +section {
  21 + display: block;
  22 +}
  23 +
  24 +/*
  25 + * Corrects inline-block display not defined in IE6/7/8/9 & FF3
  26 + */
  27 +
  28 +audio,
  29 +canvas,
  30 +video {
  31 + display: inline-block;
  32 + *display: inline;
  33 + *zoom: 1;
  34 +}
  35 +
  36 +/*
  37 + * Prevents modern browsers from displaying 'audio' without controls
  38 + */
  39 +
  40 +audio:not([controls]) {
  41 + display: none;
  42 +}
  43 +
  44 +/*
  45 + * Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4
  46 + * Known issue: no IE6 support
  47 + */
  48 +
  49 +[hidden] {
  50 + display: none;
  51 +}
  52 +
  53 +
  54 +/* =============================================================================
  55 + Base
  56 + ========================================================================== */
  57 +
  58 +/*
  59 + * 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units
  60 + * http://clagnut.com/blog/348/#c790
  61 + * 2. Keeps page centred in all browsers regardless of content height
  62 + * 3. Prevents iOS text size adjust after orientation change, without disabling user zoom
  63 + * www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/
  64 + */
  65 +
  66 +html {
  67 + font-size: 100%; /* 1 */
  68 + overflow-y: scroll; /* 2 */
  69 + -webkit-text-size-adjust: 100%; /* 3 */
  70 + -ms-text-size-adjust: 100%; /* 3 */
  71 +}
  72 +
  73 +/*
  74 + * Addresses margins handled incorrectly in IE6/7
  75 + */
  76 +
  77 +body {
  78 + margin: 0;
  79 +}
  80 +
  81 +/*
  82 + * Addresses font-family inconsistency between 'textarea' and other form elements.
  83 + */
  84 +
  85 +body,
  86 +button,
  87 +input,
  88 +select,
  89 +textarea {
  90 + font-family: sans-serif;
  91 +}
  92 +
  93 +
  94 +/* =============================================================================
  95 + Links
  96 + ========================================================================== */
  97 +
  98 +/*
  99 + * Addresses outline displayed oddly in Chrome
  100 + */
  101 +
  102 +a:focus {
  103 + outline: thin dotted;
  104 +}
  105 +
  106 +/*
  107 + * Improves readability when focused and also mouse hovered in all browsers
  108 + * people.opera.com/patrickl/experiments/keyboard/test
  109 + */
  110 +
  111 +a:hover,
  112 +a:active {
  113 + outline: 0;
  114 +}
  115 +
  116 +
  117 +/* =============================================================================
  118 + Typography
  119 + ========================================================================== */
  120 +
  121 +/*
  122 + * Neutralise smaller font-size in 'section' and 'article' in FF4+, Chrome, S5
  123 + */
  124 +
  125 +h1 {
  126 + font-size: 2em;
  127 +}
  128 +
  129 +/*
  130 + * Addresses styling not present in IE7/8/9, S5, Chrome
  131 + */
  132 +
  133 +abbr[title] {
  134 + border-bottom: 1px dotted;
  135 +}
  136 +
  137 +/*
  138 + * Addresses style set to 'bolder' in FF3+, S4/5, Chrome
  139 +*/
  140 +
  141 +b,
  142 +strong {
  143 + font-weight: bold;
  144 +}
  145 +
  146 +blockquote {
  147 + margin: 1em 40px;
  148 +}
  149 +
  150 +/*
  151 + * Addresses styling not present in S5, Chrome
  152 + */
  153 +
  154 +dfn {
  155 + font-style: italic;
  156 +}
  157 +
  158 +/*
  159 + * Addresses styling not present in IE6/7/8/9
  160 + */
  161 +
  162 +mark {
  163 + background: #ff0;
  164 + color: #000;
  165 +}
  166 +
  167 +/*
  168 + * Corrects font family set oddly in IE6, S4/5, Chrome
  169 + * en.wikipedia.org/wiki/User:Davidgothberg/Test59
  170 + */
  171 +
  172 +pre,
  173 +code,
  174 +kbd,
  175 +samp {
  176 + font-family: monospace, serif;
  177 + _font-family: 'courier new', monospace;
  178 + font-size: 1em;
  179 +}
  180 +
  181 +/*
  182 + * Improves readability of pre-formatted text in all browsers
  183 + */
  184 +
  185 +pre {
  186 + white-space: pre;
  187 + white-space: pre-wrap;
  188 + word-wrap: break-word;
  189 +}
  190 +
  191 +/*
  192 + * 1. Addresses CSS quotes not supported in IE6/7
  193 + * 2. Addresses quote property not supported in S4
  194 + */
  195 +
  196 +/* 1 */
  197 +
  198 +q {
  199 + quotes: none;
  200 +}
  201 +
  202 +/* 2 */
  203 +
  204 +q:before,
  205 +q:after {
  206 + content: '';
  207 + content: none;
  208 +}
  209 +
  210 +small {
  211 + font-size: 75%;
  212 +}
  213 +
  214 +/*
  215 + * Prevents sub and sup affecting line-height in all browsers
  216 + * gist.github.com/413930
  217 + */
  218 +
  219 +sub,
  220 +sup {
  221 + font-size: 75%;
  222 + line-height: 0;
  223 + position: relative;
  224 + vertical-align: baseline;
  225 +}
  226 +
  227 +sup {
  228 + top: -0.5em;
  229 +}
  230 +
  231 +sub {
  232 + bottom: -0.25em;
  233 +}
  234 +
  235 +
  236 +/* =============================================================================
  237 + Lists
  238 + ========================================================================== */
  239 +
  240 +ul,
  241 +ol {
  242 + margin-left: 0;
  243 + padding: 0 0 0 40px;
  244 +}
  245 +
  246 +dd {
  247 + margin: 0 0 0 40px;
  248 +}
  249 +
  250 +nav ul,
  251 +nav ol {
  252 + list-style: none;
  253 + list-style-image: none;
  254 +}
  255 +
  256 +
  257 +/* =============================================================================
  258 + Embedded content
  259 + ========================================================================== */
  260 +
  261 +/*
  262 + * 1. Removes border when inside 'a' element in IE6/7/8/9, FF3
  263 + * 2. Improves image quality when scaled in IE7
  264 + * code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/
  265 + */
  266 +
  267 +img {
  268 + border: 0; /* 1 */
  269 + -ms-interpolation-mode: bicubic; /* 2 */
  270 +}
  271 +
  272 +/*
  273 + * Corrects overflow displayed oddly in IE9
  274 + */
  275 +
  276 +svg:not(:root) {
  277 + overflow: hidden;
  278 +}
  279 +
  280 +
  281 +/* =============================================================================
  282 + Figures
  283 + ========================================================================== */
  284 +
  285 +/*
  286 + * Addresses margin not present in IE6/7/8/9, S5, O11
  287 + */
  288 +
  289 +figure {
  290 + margin: 0;
  291 +}
  292 +
  293 +
  294 +/* =============================================================================
  295 + Forms
  296 + ========================================================================== */
  297 +
  298 +/*
  299 + * Corrects margin displayed oddly in IE6/7
  300 + */
  301 +
  302 +form {
  303 + margin: 0;
  304 +}
  305 +
  306 +/*
  307 + * Define consistent border, margin, and padding
  308 + */
  309 +
  310 +fieldset {
  311 + border: 1px solid #c0c0c0;
  312 + margin: 0 2px;
  313 + padding: 0.35em 0.625em 0.75em;
  314 +}
  315 +
  316 +/*
  317 + * 1. Corrects color not being inherited in IE6/7/8/9
  318 + * 2. Corrects text not wrapping in FF3
  319 + * 3. Corrects alignment displayed oddly in IE6/7
  320 + */
  321 +
  322 +legend {
  323 + border: 0; /* 1 */
  324 + padding: 0;
  325 + white-space: normal; /* 2 */
  326 + *margin-left: -7px; /* 3 */
  327 +}
  328 +
  329 +/*
  330 + * 1. Corrects font size not being inherited in all browsers
  331 + * 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome
  332 + * 3. Improves appearance and consistency in all browsers
  333 + */
  334 +
  335 +button,
  336 +input,
  337 +select,
  338 +textarea {
  339 + font-size: 100%; /* 1 */
  340 + margin: 0; /* 2 */
  341 + vertical-align: baseline; /* 3 */
  342 + *vertical-align: middle; /* 3 */
  343 +}
  344 +
  345 +/*
  346 + * Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet
  347 + */
  348 +
  349 +button,
  350 +input {
  351 + line-height: normal; /* 1 */
  352 +}
  353 +
  354 +/*
  355 + * 1. Improves usability and consistency of cursor style between image-type 'input' and others
  356 + * 2. Corrects inability to style clickable 'input' types in iOS
  357 + * 3. Removes inner spacing in IE7 without affecting normal text inputs
  358 + * Known issue: inner spacing remains in IE6
  359 + */
  360 +
  361 +button,
  362 +input[type="button"],
  363 +input[type="reset"],
  364 +input[type="submit"] {
  365 + cursor: pointer; /* 1 */
  366 + -webkit-appearance: button; /* 2 */
  367 + *overflow: visible; /* 3 */
  368 +}
  369 +
  370 +/*
  371 + * 1. Addresses box sizing set to content-box in IE8/9
  372 + * 2. Removes excess padding in IE8/9
  373 + * 3. Removes excess padding in IE7
  374 + Known issue: excess padding remains in IE6
  375 + */
  376 +
  377 +input[type="checkbox"],
  378 +input[type="radio"] {
  379 + box-sizing: border-box; /* 1 */
  380 + padding: 0; /* 2 */
  381 + *height: 13px; /* 3 */
  382 + *width: 13px; /* 3 */
  383 +}
  384 +
  385 +/*
  386 + * 1. Addresses appearance set to searchfield in S5, Chrome
  387 + * 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof)
  388 + */
  389 +
  390 +input[type="search"] {
  391 + -webkit-appearance: textfield; /* 1 */
  392 + -moz-box-sizing: content-box;
  393 + -webkit-box-sizing: content-box; /* 2 */
  394 + box-sizing: content-box;
  395 +}
  396 +
  397 +/*
  398 + * Removes inner padding that is displayed in S5, Chrome on OS X
  399 + */
  400 +
  401 +input[type="search"]::-webkit-search-decoration {
  402 + -webkit-appearance: none;
  403 +}
  404 +
  405 +/*
  406 + * Removes search cancel button in S5, Chrome on OS X
  407 + */
  408 +
  409 +input[type="search"]::-webkit-search-cancel-button {
  410 + -webkit-appearance: none;
  411 +}
  412 +
  413 +/*
  414 + * Removes inner padding and border in FF3+
  415 + * www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/
  416 + */
  417 +
  418 +button::-moz-focus-inner,
  419 +input::-moz-focus-inner {
  420 + border: 0;
  421 + padding: 0;
  422 +}
  423 +
  424 +/*
  425 + * 1. Removes default vertical scrollbar in IE6/7/8/9
  426 + * 2. Improves readability and alignment in all browsers
  427 + */
  428 +
  429 +textarea {
  430 + overflow: auto; /* 1 */
  431 + vertical-align: top; /* 2 */
  432 +}
  433 +
  434 +
  435 +/* =============================================================================
  436 + Tables
  437 + ========================================================================== */
  438 +
  439 +/*
  440 + * Remove most spacing between table cells
  441 + */
  442 +
  443 +table {
  444 + border-collapse: collapse;
  445 + border-spacing: 0;
  446 +}
5 src/main/webapp/index.jsp
... ... @@ -0,0 +1,5 @@
  1 +<html>
  2 +<body>
  3 +<h2>Hello World!</h2>
  4 +</body>
  5 +</html>
19 src/main/webapp/js/app.js
... ... @@ -0,0 +1,19 @@
  1 +window.addEvent('domready', function () {
  2 + var amq = new org.activemq.Amq({
  3 + uri:'amq',
  4 + logging:true,
  5 + timeout:20
  6 + });
  7 + var myHandler =
  8 + {
  9 + rcvMessage:function (message) {
  10 + //console.log(message.textContent);
  11 + var span = $('time');
  12 + if(span) {
  13 + span.innerHTML = message.textContent;
  14 + }
  15 + }
  16 + };
  17 +
  18 + amq.addListener(queue, queue, myHandler.rcvMessage);
  19 +});
297 src/main/webapp/js/mootools-amq.js
... ... @@ -0,0 +1,297 @@
  1 +/**
  2 + *
  3 + * Licensed to the Apache Software Foundation (ASF) under one or more
  4 + * contributor license agreements. See the NOTICE file distributed with
  5 + * this work for additional information regarding copyright ownership.
  6 + * The ASF licenses this file to You under the Apache License, Version 2.0
  7 + * (the "License"); you may not use this file except in compliance with
  8 + * the License. You may obtain a copy of the License at
  9 + *
  10 + * http://www.apache.org/licenses/LICENSE-2.0
  11 + *
  12 + * Unless required by applicable law or agreed to in writing, software
  13 + * distributed under the License is distributed on an "AS IS" BASIS,
  14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 + * See the License for the specific language governing permissions and
  16 + * limitations under the License.
  17 + */
  18 +
  19 +var org = org || {};
  20 +org.activemq = org.activemq || {};
  21 +
  22 +org.activemq.Amq = new Class({
  23 + Implements:[Options, Events],
  24 + pollErrorDelay:5000,
  25 + batchInProgress:false,
  26 + sessionInitialized:false,
  27 + messageHandlers:{},
  28 + messageQueue:[],
  29 + options:{
  30 + uri:'/amq',
  31 + pollDelay:0,
  32 + timeout:25,
  33 + logging:false,
  34 + clientId:null,
  35 + connectStatusHandler:function (connected) {
  36 + },
  37 + sessionInitializedCallback:function () {
  38 + }
  39 + },
  40 + initialize:function (options) {
  41 + this.setOptions(options);
  42 + this.sendPoll();
  43 + },
  44 +
  45 + //public
  46 +
  47 + /**
  48 + * Implement this method to make an AJAX call to the AjaxServlet. An
  49 + * options object will accompany this class and will contain the properties
  50 + * that describe the details of the AJAX call. The options object will
  51 + * have the following properties:
  52 + *
  53 + * - method: 'get' or 'post'
  54 + * - data: query data to accompany the post or get.
  55 + * - success: A callback function that is invoked upon successful
  56 + * completion of the AJAX call. The parameter is:
  57 + * - data: The result of the AJAX call. In the case of XML
  58 + * data should resolve to a Document element.
  59 + * - error: A callback when some type of error occurs. The callback
  60 + * function's parameters should be:
  61 + * - xhr: The XmlHttpRequest object.
  62 + * - status: A text string of the status.
  63 + * - ex: The exception that caused the error.
  64 + * - headers: An object containing additional headers for the ajax request.
  65 + */
  66 + ajax:function (uri, options) {
  67 + var request = {
  68 + url:uri,
  69 + data:options.data,
  70 + onSuccess:options.success || function () {
  71 + },
  72 + onFailure:options.error || function () {
  73 + }
  74 + }
  75 + var headers = {};
  76 + if (options.headers) {
  77 + headers = options.headers;
  78 + }
  79 +
  80 + if (options.method == 'post') {
  81 + request.method = 'POST';
  82 + /* Force "Connection: close" for Mozilla browsers to work around
  83 + * a bug where XMLHttpReqeuest sends an incorrect Content-length
  84 + * header. See Mozilla Bugzilla #246651.
  85 + */
  86 + headers[ 'Connection' ] = 'close';
  87 + } else {
  88 + request.method = 'GET';
  89 + request.dataType = 'xml';
  90 + }
  91 + request['headers'] = headers;
  92 + new Request(request).send();
  93 + },
  94 + startBatch:function () {
  95 + this.batchInProgress = true;
  96 + },
  97 + endBatch:function () {
  98 + if (this.messageQueue.length > 0) {
  99 +
  100 + var messagesToSend = [];
  101 + var messagesToQueue = [];
  102 + var outgoingHeaders = null;
  103 +
  104 + // we need to ensure that messages which set headers are sent by themselves.
  105 + // if 2 'listen' messages were sent together, and a 'selector' header were added to one of them,
  106 + // AMQ would add the selector to both 'listen' commands.
  107 + for (var i = 0; i < this.messageQueue.length; i++) {
  108 + // a message with headers should always be sent by itself. if other messages have been added, send this one later.
  109 + if (this.messageQueue[ i ].headers && messagesToSend.length == 0) {
  110 + messagesToSend[ messagesToSend.length ] = this.messageQueue[ i ].message;
  111 + outgoingHeaders = this.messageQueue[ i ].headers;
  112 + } else if (!this.messageQueue[ i ].headers && !outgoingHeaders) {
  113 + messagesToSend[ messagesToSend.length ] = this.messageQueue[ i ].message;
  114 + } else {
  115 + messagesToQueue[ messagesToQueue.length ] = this.messageQueue[ i ];
  116 + }
  117 + }
  118 + var body = this.buildParams(messagesToSend);
  119 + this.messageQueue = messagesToQueue;
  120 + this.startBatch();
  121 + this.ajax(this.options.uri, {
  122 + method:'post',
  123 + headers:outgoingHeaders,
  124 + data:this.addClientId(body),
  125 + success:this.endBatch.bind(this),
  126 + error:this.errorHandler.bind(this)});
  127 + } else {
  128 + this.batchInProgress = false;
  129 + }
  130 + },
  131 + // Send a JMS message to a destination (eg topic://MY.TOPIC). Message
  132 + // should be xml or encoded xml content.
  133 + sendMessage:function (destination, message) {
  134 + this.sendJmsMessage(destination, message, 'send');
  135 + },
  136 + // Listen on a channel or topic.
  137 + // handler must be a function taking a message argument
  138 + //
  139 + // Supported options:
  140 + // selector: If supplied, it should be a SQL92 string like "property-name='value'"
  141 + // http://activemq.apache.org/selectors.html
  142 + //
  143 + // Example: addListener( 'handler', 'topic://test-topic', function(msg) { return msg; }, { selector: "property-name='property-value'" } )
  144 + addListener:function (id, destination, handler, options) {
  145 + this.messageHandlers[id] = handler;
  146 + var headers = options && options.selector ? {selector:options.selector} : null;
  147 + this.sendJmsMessage(destination, id, 'listen', headers);
  148 + },
  149 + // remove Listener from channel or topic.
  150 + removeListener:function (id, destination) {
  151 + this.messageHandlers[id] = null;
  152 + this.sendJmsMessage(destination, id, 'unlisten');
  153 + },
  154 + // for unit testing
  155 + getMessageQueue:function () {
  156 + return this.messageQueue;
  157 + },
  158 + testPollHandler:function (data) {
  159 + return this.pollHandler(data);
  160 + },
  161 + //private
  162 + messageHandler:function (data) {
  163 + var response = data.getElementsByTagName("ajax-response");
  164 + if (response != null && response.length == 1) {
  165 + this.options.connectStatusHandler(true);
  166 + var responses = response[0].childNodes; // <response>
  167 + for (var i = 0; i < responses.length; i++) {
  168 + var responseElement = responses[i];
  169 +
  170 + // only process nodes of type element.....
  171 + if (responseElement.nodeType != 1) continue;
  172 +
  173 + var id = responseElement.getAttribute('id');
  174 +
  175 + var handler = this.messageHandlers[id];
  176 +
  177 + if (this.options.logging && handler == null) {
  178 + this.log('No handler found to match message with id = ' + id);
  179 + continue;
  180 + }
  181 +
  182 + // Loop through and handle each <message>
  183 + for (var j = 0; j < responseElement.childNodes.length; j++) {
  184 + handler(responseElement.childNodes[j]);
  185 + }
  186 + }
  187 + }
  188 + },
  189 +
  190 + errorHandler:function (xhr, status, ex) {
  191 + this.options.connectStatusHandler(false);
  192 + if (this.options.logging) this.log('Error occurred in ajax call. HTTP result: ' + xhr.status + ', status: ' + status);
  193 + },
  194 +
  195 + pollErrorHandler:function (xhr, status, ex) {
  196 + this.options.connectStatusHandler(false);
  197 + if (status === 'error' && xhr.status === 0) {
  198 + if (this.options.logging) this.log('Server connection dropped.');
  199 + setTimeout(function () {
  200 + this.sendPoll();
  201 + }.bind(this), this.pollErrorDelay);
  202 + return;
  203 + }
  204 + if (this.options.logging) this.log('Error occurred in poll. HTTP result: ' + xhr.status + ', status: ' + status);
  205 + setTimeout(function () {
  206 + this.sendPoll();
  207 + }.bind(this), this.pollErrorDelay);
  208 + },
  209 +
  210 + pollHandler:function (text, xml) {
  211 + try {
  212 + this.messageHandler(xml);
  213 + } catch (e) {
  214 + if (this.options.logging) this.log('Exception in the poll handler: ' + xml, e);
  215 + throw(e);
  216 + } finally {
  217 + setTimeout(this.sendPoll.bind(this), this.options.pollDelay);
  218 + }
  219 + },
  220 +
  221 + initHandler:function (data) {
  222 + this.sessionInitialized = true;
  223 + if (this.options.sessionInitializedCallback) {
  224 + this.options.sessionInitializedCallback();
  225 + }
  226 + this.sendPoll();
  227 + },
  228 +
  229 + sendPoll:function () {
  230 + // Workaround IE6 bug where it caches the response
  231 + // Generate a unique query string with date and random
  232 + var now = new Date();
  233 + var timeoutArg = this.sessionInitialized ? this.options.timeout : 0.001;
  234 + var data = 'timeout=' + timeoutArg * 1000
  235 + + '&d=' + now.getTime()
  236 + + '&r=' + Math.random();
  237 + var successCallback = this.sessionInitialized ? this.pollHandler.bind(this) : this.initHandler.bind(this);
  238 +
  239 + var options = { method:'get',
  240 + data:this.addClientId(data),
  241 + success:successCallback,
  242 + error:this.pollErrorHandler.bind(this)};
  243 + this.ajax(this.options.uri, options);
  244 + },
  245 +
  246 + sendJmsMessage:function (destination, message, type, headers) {
  247 + var message = {
  248 + destination:destination,
  249 + message:message,
  250 + messageType:type
  251 + };
  252 + // Add message to outbound queue
  253 + if (this.batchInProgress) {
  254 + this.messageQueue[this.messageQueue.length] = {message:message, headers:headers};
  255 + } else {
  256 + this.startBatch();
  257 + this.ajax(this.options.uri, { method:'post',
  258 + data:this.addClientId(this.buildParams([message])),
  259 + error:this.errorHandler.bind(this),
  260 + headers:headers,
  261 + success:this.endBatch.bind(this)});
  262 + }
  263 + },
  264 +
  265 + buildParams:function (msgs) {
  266 + var s = [];
  267 + for (var i = 0, c = msgs.length; i < c; i++) {
  268 + if (i != 0) s[s.length] = '&';
  269 + s[s.length] = ((i == 0) ? 'destination' : 'd' + i);
  270 + s[s.length] = '=';
  271 + s[s.length] = msgs[i].destination;
  272 + s[s.length] = ((i == 0) ? '&message' : '&m' + i);
  273 + s[s.length] = '=';
  274 + s[s.length] = msgs[i].message;
  275 + s[s.length] = ((i == 0) ? '&type' : '&t' + i);
  276 + s[s.length] = '=';
  277 + s[s.length] = msgs[i].messageType;
  278 + }
  279 + return s.join('');
  280 + },
  281 +// add clientId to data if it exists, before passing data to ajax handler.
  282 + addClientId:function (data) {
  283 + var output = data || '';
  284 + if (this.options.clientId) {
  285 + if (output.length > 0) {
  286 + output += '&';
  287 + }
  288 + output += 'clientId=' + this.options.clientId;
  289 + }
  290 + return output;
  291 + },
  292 +
  293 + log:function (message, exception) {
  294 + if (typeof console != 'undefined' && console.log) console.log(message);
  295 + }
  296 +});
  297 +
480 src/main/webapp/js/mootools-core-1.4.2-full-nocompat.js
... ... @@ -0,0 +1,480 @@
  1 +/*
  2 +---
  3 +MooTools: the javascript framework
  4 +
  5 +web build:
  6 + - http://mootools.net/core/76bf47062d6c1983d66ce47ad66aa0e0
  7 +
  8 +packager build:
  9 + - packager build Core/Core Core/Array Core/String Core/Number Core/Function Core/Object Core/Event Core/Browser Core/Class Core/Class.Extras Core/Slick.Parser Core/Slick.Finder Core/Element Core/Element.Style Core/Element.Event Core/Element.Delegation Core/Element.Dimensions Core/Fx Core/Fx.CSS Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request Core/Request.HTML Core/Request.JSON Core/Cookie Core/JSON Core/DOMReady Core/Swiff
  10 +
  11 +copyrights:
  12 + - [MooTools](http://mootools.net)
  13 +
  14 +licenses:
  15 + - [MIT License](http://mootools.net/license.txt)
  16 +...
  17 +*/
  18 +(function(){this.MooTools={version:"1.4.2",build:"552dfd4704fccffed444e0211c50831a2bfe209f"};var o=this.typeOf=function(i){if(i==null){return"null";}if(i.$family!=null){return i.$family();
  19 +}if(i.nodeName){if(i.nodeType==1){return"element";}if(i.nodeType==3){return(/\S/).test(i.nodeValue)?"textnode":"whitespace";}}else{if(typeof i.length=="number"){if(i.callee){return"arguments";
  20 +}if("item" in i){return"collection";}}}return typeof i;};var j=this.instanceOf=function(t,i){if(t==null){return false;}var s=t.$constructor||t.constructor;
  21 +while(s){if(s===i){return true;}s=s.parent;}return t instanceof i;};var f=this.Function;var p=true;for(var k in {toString:1}){p=null;}if(p){p=["hasOwnProperty","valueOf","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","constructor"];
  22 +}f.prototype.overloadSetter=function(s){var i=this;return function(u,t){if(u==null){return this;}if(s||typeof u!="string"){for(var v in u){i.call(this,v,u[v]);
  23 +}if(p){for(var w=p.length;w--;){v=p[w];if(u.hasOwnProperty(v)){i.call(this,v,u[v]);}}}}else{i.call(this,u,t);}return this;};};f.prototype.overloadGetter=function(s){var i=this;
  24 +return function(u){var v,t;if(s||typeof u!="string"){v=u;}else{if(arguments.length>1){v=arguments;}}if(v){t={};for(var w=0;w<v.length;w++){t[v[w]]=i.call(this,v[w]);
  25 +}}else{t=i.call(this,u);}return t;};};f.prototype.extend=function(i,s){this[i]=s;}.overloadSetter();f.prototype.implement=function(i,s){this.prototype[i]=s;
  26 +}.overloadSetter();var n=Array.prototype.slice;f.from=function(i){return(o(i)=="function")?i:function(){return i;};};Array.from=function(i){if(i==null){return[];
  27 +}return(a.isEnumerable(i)&&typeof i!="string")?(o(i)=="array")?i:n.call(i):[i];};Number.from=function(s){var i=parseFloat(s);return isFinite(i)?i:null;
  28 +};String.from=function(i){return i+"";};f.implement({hide:function(){this.$hidden=true;return this;},protect:function(){this.$protected=true;return this;
  29 +}});var a=this.Type=function(u,t){if(u){var s=u.toLowerCase();var i=function(v){return(o(v)==s);};a["is"+u]=i;if(t!=null){t.prototype.$family=(function(){return s;
  30 +}).hide();}}if(t==null){return null;}t.extend(this);t.$constructor=a;t.prototype.$constructor=t;return t;};var e=Object.prototype.toString;a.isEnumerable=function(i){return(i!=null&&typeof i.length=="number"&&e.call(i)!="[object Function]");
  31 +};var q={};var r=function(i){var s=o(i.prototype);return q[s]||(q[s]=[]);};var b=function(t,x){if(x&&x.$hidden){return;}var s=r(this);for(var u=0;u<s.length;
  32 +u++){var w=s[u];if(o(w)=="type"){b.call(w,t,x);}else{w.call(this,t,x);}}var v=this.prototype[t];if(v==null||!v.$protected){this.prototype[t]=x;}if(this[t]==null&&o(x)=="function"){m.call(this,t,function(i){return x.apply(i,n.call(arguments,1));
  33 +});}};var m=function(i,t){if(t&&t.$hidden){return;}var s=this[i];if(s==null||!s.$protected){this[i]=t;}};a.implement({implement:b.overloadSetter(),extend:m.overloadSetter(),alias:function(i,s){b.call(this,i,this.prototype[s]);
  34 +}.overloadSetter(),mirror:function(i){r(this).push(i);return this;}});new a("Type",a);var d=function(s,w,u){var t=(w!=Object),A=w.prototype;if(t){w=new a(s,w);
  35 +}for(var x=0,v=u.length;x<v;x++){var B=u[x],z=w[B],y=A[B];if(z){z.protect();}if(t&&y){delete A[B];A[B]=y.protect();}}if(t){w.implement(A);}return d;};d("String",String,["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","quote","replace","search","slice","split","substr","substring","trim","toLowerCase","toUpperCase"])("Array",Array,["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice","indexOf","lastIndexOf","filter","forEach","every","map","some","reduce","reduceRight"])("Number",Number,["toExponential","toFixed","toLocaleString","toPrecision"])("Function",f,["apply","call","bind"])("RegExp",RegExp,["exec","test"])("Object",Object,["create","defineProperty","defineProperties","keys","getPrototypeOf","getOwnPropertyDescriptor","getOwnPropertyNames","preventExtensions","isExtensible","seal","isSealed","freeze","isFrozen"])("Date",Date,["now"]);
  36 +Object.extend=m.overloadSetter();Date.extend("now",function(){return +(new Date);});new a("Boolean",Boolean);Number.prototype.$family=function(){return isFinite(this)?"number":"null";
  37 +}.hide();Number.extend("random",function(s,i){return Math.floor(Math.random()*(i-s+1)+s);});var g=Object.prototype.hasOwnProperty;Object.extend("forEach",function(i,t,u){for(var s in i){if(g.call(i,s)){t.call(u,i[s],s,i);
  38 +}}});Object.each=Object.forEach;Array.implement({forEach:function(u,v){for(var t=0,s=this.length;t<s;t++){if(t in this){u.call(v,this[t],t,this);}}},each:function(i,s){Array.forEach(this,i,s);
  39 +return this;}});var l=function(i){switch(o(i)){case"array":return i.clone();case"object":return Object.clone(i);default:return i;}};Array.implement("clone",function(){var s=this.length,t=new Array(s);
  40 +while(s--){t[s]=l(this[s]);}return t;});var h=function(s,i,t){switch(o(t)){case"object":if(o(s[i])=="object"){Object.merge(s[i],t);}else{s[i]=Object.clone(t);
  41 +}break;case"array":s[i]=t.clone();break;default:s[i]=t;}return s;};Object.extend({merge:function(z,u,t){if(o(u)=="string"){return h(z,u,t);}for(var y=1,s=arguments.length;
  42 +y<s;y++){var w=arguments[y];for(var x in w){h(z,x,w[x]);}}return z;},clone:function(i){var t={};for(var s in i){t[s]=l(i[s]);}return t;},append:function(w){for(var v=1,t=arguments.length;
  43 +v<t;v++){var s=arguments[v]||{};for(var u in s){w[u]=s[u];}}return w;}});["Object","WhiteSpace","TextNode","Collection","Arguments"].each(function(i){new a(i);
  44 +});var c=Date.now();String.extend("uniqueID",function(){return(c++).toString(36);});})();Array.implement({every:function(c,d){for(var b=0,a=this.length>>>0;
  45 +b<a;b++){if((b in this)&&!c.call(d,this[b],b,this)){return false;}}return true;},filter:function(d,e){var c=[];for(var b=0,a=this.length>>>0;b<a;b++){if((b in this)&&d.call(e,this[b],b,this)){c.push(this[b]);
  46 +}}return c;},indexOf:function(c,d){var b=this.length>>>0;for(var a=(d<0)?Math.max(0,b+d):d||0;a<b;a++){if(this[a]===c){return a;}}return -1;},map:function(c,e){var d=this.length>>>0,b=Array(d);
  47 +for(var a=0;a<d;a++){if(a in this){b[a]=c.call(e,this[a],a,this);}}return b;},some:function(c,d){for(var b=0,a=this.length>>>0;b<a;b++){if((b in this)&&c.call(d,this[b],b,this)){return true;
  48 +}}return false;},clean:function(){return this.filter(function(a){return a!=null;});},invoke:function(a){var b=Array.slice(arguments,1);return this.map(function(c){return c[a].apply(c,b);
  49 +});},associate:function(c){var d={},b=Math.min(this.length,c.length);for(var a=0;a<b;a++){d[c[a]]=this[a];}return d;},link:function(c){var a={};for(var e=0,b=this.length;
  50 +e<b;e++){for(var d in c){if(c[d](this[e])){a[d]=this[e];delete c[d];break;}}}return a;},contains:function(a,b){return this.indexOf(a,b)!=-1;},append:function(a){this.push.apply(this,a);
  51 +return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[Number.random(0,this.length-1)]:null;
  52 +},include:function(a){if(!this.contains(a)){this.push(a);}return this;},combine:function(c){for(var b=0,a=c.length;b<a;b++){this.include(c[b]);}return this;
  53 +},erase:function(b){for(var a=this.length;a--;){if(this[a]===b){this.splice(a,1);}}return this;},empty:function(){this.length=0;return this;},flatten:function(){var d=[];
  54 +for(var b=0,a=this.length;b<a;b++){var c=typeOf(this[b]);if(c=="null"){continue;}d=d.concat((c=="array"||c=="collection"||c=="arguments"||instanceOf(this[b],Array))?Array.flatten(this[b]):this[b]);
  55 +}return d;},pick:function(){for(var b=0,a=this.length;b<a;b++){if(this[b]!=null){return this[b];}}return null;},hexToRgb:function(b){if(this.length!=3){return null;
  56 +}var a=this.map(function(c){if(c.length==1){c+=c;}return c.toInt(16);});return(b)?a:"rgb("+a+")";},rgbToHex:function(d){if(this.length<3){return null;}if(this.length==4&&this[3]==0&&!d){return"transparent";
  57 +}var b=[];for(var a=0;a<3;a++){var c=(this[a]-0).toString(16);b.push((c.length==1)?"0"+c:c);}return(d)?b:"#"+b.join("");}});String.implement({test:function(a,b){return((typeOf(a)=="regexp")?a:new RegExp(""+a,b)).test(this);
  58 +},contains:function(a,b){return(b)?(b+this+b).indexOf(b+a+b)>-1:String(this).indexOf(a)>-1;},trim:function(){return String(this).replace(/^\s+|\s+$/g,"");
  59 +},clean:function(){return String(this).replace(/\s+/g," ").trim();},camelCase:function(){return String(this).replace(/-\D/g,function(a){return a.charAt(1).toUpperCase();
  60 +});},hyphenate:function(){return String(this).replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase());});},capitalize:function(){return String(this).replace(/\b[a-z]/g,function(a){return a.toUpperCase();
  61 +});},escapeRegExp:function(){return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");},toInt:function(a){return parseInt(this,a||10);},toFloat:function(){return parseFloat(this);
  62 +},hexToRgb:function(b){var a=String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(a)?a.slice(1).hexToRgb(b):null;},rgbToHex:function(b){var a=String(this).match(/\d{1,3}/g);
  63 +return(a)?a.rgbToHex(b):null;},substitute:function(a,b){return String(this).replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1);
  64 +}return(a[c]!=null)?a[c]:"";});}});Number.implement({limit:function(b,a){return Math.min(a,Math.max(b,this));},round:function(a){a=Math.pow(10,a||0).toFixed(a<0?-a:0);
  65 +return Math.round(this*a)/a;},times:function(b,c){for(var a=0;a<this;a++){b.call(c,a,this);}},toFloat:function(){return parseFloat(this);},toInt:function(a){return parseInt(this,a||10);
  66 +}});Number.alias("each","times");(function(b){var a={};b.each(function(c){if(!Number[c]){a[c]=function(){return Math[c].apply(null,[this].concat(Array.from(arguments)));
  67 +};}});Number.implement(a);})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);Function.extend({attempt:function(){for(var b=0,a=arguments.length;
  68 +b<a;b++){try{return arguments[b]();}catch(c){}}return null;}});Function.implement({attempt:function(a,c){try{return this.apply(c,Array.from(a));}catch(b){}return null;
  69 +},bind:function(e){var a=this,b=arguments.length>1?Array.slice(arguments,1):null,d=function(){};var c=function(){var g=e,h=arguments.length;if(this instanceof c){d.prototype=a.prototype;
  70 +g=new d;}var f=(!b&&!h)?a.call(g):a.apply(g,b&&h?b.concat(Array.slice(arguments)):b||arguments);return g==e?f:g;};return c;},pass:function(b,c){var a=this;
  71 +if(b!=null){b=Array.from(b);}return function(){return a.apply(c,b||arguments);};},delay:function(b,c,a){return setTimeout(this.pass((a==null?[]:a),c),b);
  72 +},periodical:function(c,b,a){return setInterval(this.pass((a==null?[]:a),b),c);}});(function(){var a=Object.prototype.hasOwnProperty;Object.extend({subset:function(d,g){var f={};
  73 +for(var e=0,b=g.length;e<b;e++){var c=g[e];if(c in d){f[c]=d[c];}}return f;},map:function(b,e,f){var d={};for(var c in b){if(a.call(b,c)){d[c]=e.call(f,b[c],c,b);
  74 +}}return d;},filter:function(b,e,g){var d={};for(var c in b){var f=b[c];if(a.call(b,c)&&e.call(g,f,c,b)){d[c]=f;}}return d;},every:function(b,d,e){for(var c in b){if(a.call(b,c)&&!d.call(e,b[c],c)){return false;
  75 +}}return true;},some:function(b,d,e){for(var c in b){if(a.call(b,c)&&d.call(e,b[c],c)){return true;}}return false;},keys:function(b){var d=[];for(var c in b){if(a.call(b,c)){d.push(c);
  76 +}}return d;},values:function(c){var b=[];for(var d in c){if(a.call(c,d)){b.push(c[d]);}}return b;},getLength:function(b){return Object.keys(b).length;},keyOf:function(b,d){for(var c in b){if(a.call(b,c)&&b[c]===d){return c;
  77 +}}return null;},contains:function(b,c){return Object.keyOf(b,c)!=null;},toQueryString:function(b,c){var d=[];Object.each(b,function(h,g){if(c){g=c+"["+g+"]";
  78 +}var f;switch(typeOf(h)){case"object":f=Object.toQueryString(h,g);break;case"array":var e={};h.each(function(k,j){e[j]=k;});f=Object.toQueryString(e,g);
  79 +break;default:f=g+"="+encodeURIComponent(h);}if(h!=null){d.push(f);}});return d.join("&");}});})();(function(){var j=this.document;var g=j.window=this;
  80 +var a=navigator.userAgent.toLowerCase(),b=navigator.platform.toLowerCase(),h=a.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/)||[null,"unknown",0],d=h[1]=="ie"&&j.documentMode;
  81 +var n=this.Browser={extend:Function.prototype.extend,name:(h[1]=="version")?h[3]:h[1],version:d||parseFloat((h[1]=="opera"&&h[4])?h[4]:h[2]),Platform:{name:a.match(/ip(?:ad|od|hone)/)?"ios":(a.match(/(?:webos|android)/)||b.match(/mac|win|linux/)||["other"])[0]},Features:{xpath:!!(j.evaluate),air:!!(g.runtime),query:!!(j.querySelector),json:!!(g.JSON)},Plugins:{}};
  82 +n[n.name]=true;n[n.name+parseInt(n.version,10)]=true;n.Platform[n.Platform.name]=true;n.Request=(function(){var p=function(){return new XMLHttpRequest();
  83 +};var o=function(){return new ActiveXObject("MSXML2.XMLHTTP");};var e=function(){return new ActiveXObject("Microsoft.XMLHTTP");};return Function.attempt(function(){p();
  84 +return p;},function(){o();return o;},function(){e();return e;});})();n.Features.xhr=!!(n.Request);var i=(Function.attempt(function(){return navigator.plugins["Shockwave Flash"].description;
  85 +},function(){return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version");})||"0 r0").match(/\d+/g);n.Plugins.Flash={version:Number(i[0]||"0."+i[1])||0,build:Number(i[2])||0};
  86 +n.exec=function(o){if(!o){return o;}if(g.execScript){g.execScript(o);}else{var e=j.createElement("script");e.setAttribute("type","text/javascript");e.text=o;
  87 +j.head.appendChild(e);j.head.removeChild(e);}return o;};String.implement("stripScripts",function(o){var e="";var p=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(q,r){e+=r+"\n";
  88 +return"";});if(o===true){n.exec(e);}else{if(typeOf(o)=="function"){o(e,p);}}return p;});n.extend({Document:this.Document,Window:this.Window,Element:this.Element,Event:this.Event});
  89 +this.Window=this.$constructor=new Type("Window",function(){});this.$family=Function.from("window").hide();Window.mirror(function(e,o){g[e]=o;});this.Document=j.$constructor=new Type("Document",function(){});
  90 +j.$family=Function.from("document").hide();Document.mirror(function(e,o){j[e]=o;});j.html=j.documentElement;if(!j.head){j.head=j.getElementsByTagName("head")[0];
  91 +}if(j.execCommand){try{j.execCommand("BackgroundImageCache",false,true);}catch(f){}}if(this.attachEvent&&!this.addEventListener){var c=function(){this.detachEvent("onunload",c);
  92 +j.head=j.html=j.window=null;};this.attachEvent("onunload",c);}var l=Array.from;try{l(j.html.childNodes);}catch(f){Array.from=function(o){if(typeof o!="string"&&Type.isEnumerable(o)&&typeOf(o)!="array"){var e=o.length,p=new Array(e);
  93 +while(e--){p[e]=o[e];}return p;}return l(o);};var k=Array.prototype,m=k.slice;["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice"].each(function(e){var o=k[e];
  94 +Array[e]=function(p){return o.apply(Array.from(p),m.call(arguments,1));};});}})();(function(){var b={};var a=this.DOMEvent=new Type("DOMEvent",function(c,g){if(!g){g=window;
  95 +}c=c||g.event;if(c.$extended){return c;}this.event=c;this.$extended=true;this.shift=c.shiftKey;this.control=c.ctrlKey;this.alt=c.altKey;this.meta=c.metaKey;
  96 +var i=this.type=c.type;var h=c.target||c.srcElement;while(h&&h.nodeType==3){h=h.parentNode;}this.target=document.id(h);if(i.indexOf("key")==0){var d=this.code=(c.which||c.keyCode);
  97 +this.key=b[d];if(i=="keydown"){if(d>111&&d<124){this.key="f"+(d-111);}else{if(d>95&&d<106){this.key=d-96;}}}if(this.key==null){this.key=String.fromCharCode(d).toLowerCase();
  98 +}}else{if(i=="click"||i=="dblclick"||i=="contextmenu"||i=="DOMMouseScroll"||i.indexOf("mouse")==0){var j=g.document;j=(!j.compatMode||j.compatMode=="CSS1Compat")?j.html:j.body;
  99 +this.page={x:(c.pageX!=null)?c.pageX:c.clientX+j.scrollLeft,y:(c.pageY!=null)?c.pageY:c.clientY+j.scrollTop};this.client={x:(c.pageX!=null)?c.pageX-g.pageXOffset:c.clientX,y:(c.pageY!=null)?c.pageY-g.pageYOffset:c.clientY};
  100 +if(i=="DOMMouseScroll"||i=="mousewhee