Sha256: f4ce3ae56318f82b814faa417b7276fd89100fcc771e38ddf48b48c9b9effbda

Contents?: true

Size: 1.72 KB

Versions: 8

Compression:

Stored size: 1.72 KB

Contents

/*!
* Aloha Editor
* Author & Copyright (c) 2010 Gentics Software GmbH
* aloha-sales@gentics.com
* Licensed unter the terms of http://www.aloha-editor.com/license.html
*/

define(
['aloha', 'aloha/jquery', 'aloha/plugin', 'css!highlighteditables/css/highlighteditables.css'],
function(Aloha, jQuery, Plugin) {
	

	var
		GENTICS = window.GENTICS;

	return Plugin.create('highlighteditables', {

		init: function () {

			// remember refernce to this class for callback
			var that = this;

			// highlight editables as long as the mouse is moving
			GENTICS.Utils.Position.addMouseMoveCallback(function () {
				var i, editable;

				for ( i = 0; i < Aloha.editables.length; i++) {
					editable = Aloha.editables[i];
					if (!Aloha.activeEditable && !editable.isDisabled()) {
						editable.obj.addClass('aloha-editable-highlight');
					}
				}
			});

			// fade editable borders when mouse stops moving
			GENTICS.Utils.Position.addMouseStopCallback(function () {
				that.fade();
			});

			// mark active Editable with a css class
			Aloha.bind(
					"aloha-editable-activated",
					function (jEvent, aEvent) {
						that.fade();
					}
			);

		},
		/**
		 * fades all highlighted editables
		 */
		fade: function () {
			var
				i, editable,
				animateEnd = function () {
					jQuery(this).css('outline', '');
				};
			for ( i = 0; i < Aloha.editables.length; i++) {
				editable = Aloha.editables[i].obj;
				if (editable.hasClass('aloha-editable-highlight')) {
					editable.css('outline', editable.css('outlineColor') + ' ' + editable.css('outlineStyle') + ' ' + editable.css('outlineWidth'))
						.removeClass('aloha-editable-highlight')
						.animate({
							outlineWidth : '0px'
						}, 300, 'swing', animateEnd);
				}
			}
		}

	});
});

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
locomotive-aloha-rails-0.20.1.5 vendor/assets/javascripts/aloha/plugins/common/highlighteditables/lib/highlighteditables-plugin.js
aloha-rails-0.0.2 vendor/assets/javascripts/aloha/plugins/common/highlighteditables/lib/highlighteditables-plugin.js
locomotive-aloha-rails-0.20.1.4 vendor/assets/javascripts/aloha/plugins/common/highlighteditables/lib/highlighteditables-plugin.js
locomotive-aloha-rails-0.20.1.3 vendor/assets/javascripts/aloha/plugins/common/highlighteditables/lib/highlighteditables-plugin.js
locomotive-aloha-rails-0.20.1.2 vendor/assets/javascripts/aloha/plugins/common/highlighteditables/lib/highlighteditables-plugin.js
locomotive-aloha-rails-0.20.1.1 vendor/assets/javascripts/aloha/plugins/common/highlighteditables/lib/highlighteditables-plugin.js
aloha-rails-0.0.1 vendor/assets/javascripts/aloha/plugins/common/highlighteditables/lib/highlighteditables-plugin.js
locomotive-aloha-rails-0.20.1 vendor/assets/javascripts/aloha/plugins/common/highlighteditables/lib/highlighteditables-plugin.js