You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2012/10/06 19:18:36 UTC
svn commit: r1395121 - in
/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow: ./
jquery.meow.css jquery.meow.js
Author: tveronezi
Date: Sat Oct 6 17:18:35 2012
New Revision: 1395121
URL: http://svn.apache.org/viewvc?rev=1395121&view=rev
Log:
https://issues.apache.org/jira/browse/TOMEE-447
Added:
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/jquery.meow.css
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/jquery.meow.js
Added: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/jquery.meow.css
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/jquery.meow.css?rev=1395121&view=auto
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/jquery.meow.css (added)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/jquery.meow.css Sat Oct 6 17:18:35 2012
@@ -0,0 +1,108 @@
+.meows {
+ position: fixed;
+ top: 0;
+ right: 0;
+}
+
+.meow {
+ position: relative;
+ margin: 20px 20px 0 0;
+}
+
+.meow .inner {
+ width: 300px;
+ min-height: 48px;
+ padding: 10px;
+ font-family: Helvetica, Arial, sans-serif;
+ font-size: 15px;
+ color: #fff;
+ text-shadow: 1px 1px 3px #000;
+ background: #191919;
+ border: 2px solid transparent;
+ -webkit-border-radius: 10px;
+ -khtml-border-radius: 10px;
+ -moz-border-radius: 10px;
+ -ms-border-radius: 10px;
+ -o-border-radius: 10px;
+ border-radius: 10px;
+ -webkit-opacity: 0.75;
+ -khtml-opacity: 0.75;
+ -moz-opacity: 0.75;
+ -ms-opacity: 0.75;
+ -o-opacity: 0.75;
+ opacity: 0.75;
+ zoom: 1;
+ -webkit-box-shadow: 2px 2px 10px rgba(25, 25, 25, 0.25);
+ -khtml-box-shadow: 2px 2px 10px rgba(25, 25, 25, 0.25);
+ -moz-box-shadow: 2px 2px 10px rgba(25, 25, 25, 0.25);
+ -ms-box-shadow: 2px 2px 10px rgba(25, 25, 25, 0.25);
+ -o-box-shadow: 2px 2px 10px rgba(25, 25, 25, 0.25);
+ box-shadow: 2px 2px 10px rgba(25, 25, 25, 0.25);
+}
+
+.meow .inner:after {
+ display: block;
+ height: 0;
+ clear: both;
+ line-height: 0;
+ content: "\0200";
+ visibility: hidden;
+}
+
+.meow.hover .inner {
+ border: 2px solid #fff;
+}
+
+.meow .inner h1 {
+ padding: 0;
+ margin: 0;
+ font-size: 14px;
+ font-weight: bold;
+ line-height: 1;
+}
+
+.meow .inner .icon {
+ float: left;
+ width: 48px;
+ height: 48px;
+ margin-right: 6px;
+}
+
+.meow .inner .icon img {
+ max-width: 48px;
+ max-height: 48px;
+}
+
+.meow .inner .close {
+ display: none;
+}
+
+.meow.hover .inner .close {
+ position: absolute;
+ top: 4px;
+ left: 4px;
+ display: block;
+ width: 18px;
+ height: 18px;
+ font-size: 22px;
+ font-weight: 500;
+ line-height: 14px;
+ color: #ffffff;
+ text-align: center;
+ text-decoration: none;
+ background: #191919;
+ border: 2px solid #ffffff;
+ -webkit-border-radius: 18px;
+ -khtml-border-radius: 18px;
+ -moz-border-radius: 18px;
+ -ms-border-radius: 18px;
+ -o-border-radius: 18px;
+ border-radius: 18px;
+ -webkit-opacity: 0.75;
+ -khtml-opacity: 0.75;
+ -moz-opacity: 0.75;
+ -ms-opacity: 0.75;
+ -o-opacity: 0.75;
+ opacity: 0.75;
+ zoom: 1;
+}
Added: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/jquery.meow.js
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/jquery.meow.js?rev=1395121&view=auto
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/jquery.meow.js (added)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/lib/meow/jquery.meow.js Sat Oct 6 17:18:35 2012
@@ -0,0 +1,197 @@
+// jQuery Meow by Zachary Stewart (zacstewart.com)
+//
+// Copyright (c) 2011 Zachary Stewart
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+(function ($, window) {
+ 'use strict';
+ // Meow queue
+ var meow_area,
+ meows = {
+ queue: {},
+ add: function (meow) {
+ this.queue[meow.timestamp] = meow;
+ },
+ get: function (timestamp) {
+ return this.queue[timestamp];
+ },
+ remove: function (timestamp) {
+ delete this.queue[timestamp];
+ },
+ size: function () {
+ var timestamp,
+ size = 0;
+ for (timestamp in this.queue) {
+ if (this.queue.hasOwnProperty(timestamp)) { size += 1; }
+ }
+ return size;
+ }
+ },
+ // Meow constructor
+ Meow = function (options) {
+ var that = this;
+
+ this.timestamp = new Date().getTime(); // used to identify this meow and timeout
+ this.hovered = false; // whether mouse is over or not
+
+ if (meows.size() <= 0) {
+ meow_area = 'meows-' + new Date().getTime();
+ $('body').prepend($(window.document.createElement('div')).attr({'id': meow_area, 'class': 'meows'}));
+ if (typeof options.beforeCreateFirst === 'function') {
+ options.beforeCreateFirst.call(that);
+ }
+ }
+
+ if (typeof options.title === 'string') {
+ this.title = options.title;
+ }
+
+ if (typeof options.message === 'string') {
+ this.message = options.message;
+ } else if (options.message instanceof jQuery) {
+ if (options.message.is('input,textarea,select')) {
+ this.message = options.message.val();
+ } else {
+ this.message = options.message.text();
+ }
+
+ if (typeof this.title === 'undefined' && typeof options.message.attr('title') === 'string') {
+ this.title = options.message.attr('title');
+ }
+ }
+
+ if (typeof options.icon === 'string') {
+ this.icon = options.icon;
+ }
+ if (options.sticky) {
+ this.duration = Infinity;
+ } else {
+ this.duration = options.duration || 5000;
+ }
+
+ // Call callback if it's defined (this = meow object)
+ if (typeof options.beforeCreate === 'function') {
+ options.beforeCreate.call(that);
+ }
+
+ // Add the meow to the meow area
+ $('#' + meow_area).append($(window.document.createElement('div'))
+ .attr('id', 'meow-' + this.timestamp.toString())
+ .addClass('meow')
+ .html($(window.document.createElement('div')).addClass('inner').html(this.message))
+ .hide()
+ .fadeIn(400));
+
+ this.manifest = $('#meow-' + this.timestamp.toString());
+
+ // Add title if it's defined
+ if (typeof this.title === 'string') {
+ this.manifest.find('.inner').prepend(
+ $(window.document.createElement('h1')).text(this.title)
+ );
+ }
+
+ // Add icon if it's defined
+ if (typeof that.icon === 'string') {
+ this.manifest.find('.inner').prepend(
+ $(window.document.createElement('div')).addClass('icon').html(
+ $(window.document.createElement('img')).attr('src', this.icon)
+ )
+ );
+ }
+
+ // Add close button if the meow isn't uncloseable
+ // TODO: this close button needs to be much prettier
+ if (options.closeable !== false) {
+ this.manifest.find('.inner').prepend(
+ $(window.document.createElement('a'))
+ .addClass('close')
+ .html('×')
+ .attr('href', '#close-meow-' + that.timestamp)
+ .click(function (e) {
+ e.preventDefault();
+ that.destroy();
+ })
+ );
+ }
+
+ this.manifest.bind('mouseenter mouseleave', function (event) {
+ if (event.type === 'mouseleave') {
+ that.hovered = false;
+ that.manifest.removeClass('hover');
+ // Destroy the mow on mouseleave if it's timed out
+ if (that.timestamp + that.duration <= new Date().getTime()) {
+ that.destroy();
+ }
+ } else {
+ that.hovered = true;
+ that.manifest.addClass('hover');
+ }
+ });
+
+ // Add a timeout if the duration isn't Infinity
+ if (this.duration !== Infinity) {
+ this.timeout = window.setTimeout(function () {
+ // Make sure this meow hasn't already been destroyed
+ if (typeof meows.get(that.timestamp) !== 'undefined') {
+ // Call callback if it's defined (this = meow DOM element)
+ if (typeof options.onTimeout === 'function') {
+ options.onTimeout.call(that.manifest);
+ }
+ // Don't destroy if user is hovering over meow
+ if (that.hovered !== true && typeof that === 'object') {
+ that.destroy();
+ }
+ }
+ }, that.duration);
+ }
+
+ this.destroy = function () {
+ if (that.destroyed !== true) {
+ // Call callback if it's defined (this = meow DOM element)
+ if (typeof options.beforeDestroy === 'function') {
+ options.beforeDestroy.call(that.manifest);
+ }
+ that.manifest.find('.inner').fadeTo(400, 0, function () {
+ that.manifest.slideUp(function () {
+ that.manifest.remove();
+ that.destroyed = true;
+ meows.remove(that.timestamp);
+ if (typeof options.afterDestroy === 'function') {
+ options.afterDestroy.call(null);
+ }
+ if (meows.size() <= 0) {
+ $('#' + meow_area).remove();
+ if (typeof options.afterDestroyLast === 'function') {
+ options.afterDestroyLast.call(null);
+ }
+ }
+ });
+ });
+ }
+ };
+ };
+
+ $.fn.meow = function (args) {
+ meows.add(new Meow(args));
+ };
+ $.meow = $.fn.meow;
+}(jQuery, window));