[Tts-dev-commits] r66 - zen-tts

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Wed Jun 1 00:05:10 CEST 2011


Author: vjrj_
Date: 2011-06-01 00:05:10 +0200 (Wed, 01 Jun 2011)
New Revision: 66

Added:
   zen-tts/jquery.nordz.heartBeat.js
Modified:
   zen-tts/template.php
   zen-tts/voicemap.js
Log:
heart beat buddle test

Added: zen-tts/jquery.nordz.heartBeat.js
===================================================================
--- zen-tts/jquery.nordz.heartBeat.js	                        (rev 0)
+++ zen-tts/jquery.nordz.heartBeat.js	2011-05-31 22:05:10 UTC (rev 66)
@@ -0,0 +1,87 @@
+// Plugin: heartbeat.
+//
+// Author : Nordès Ménard-Lamarre
+// Last modif: 08/08/08
+// Licence: This code is under the MIT license
+// Version: 0.1
+//
+// Copyright (c) 2008 Nordès Ménard-Lamarre
+// 
+// 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($) {
+	$.fn.heartBeat = function(options){
+		// Heart beat plugin
+		//
+		// build main options before element iteration
+		var opts = $.extend({}, $.fn.heartBeat.defaults, options);
+		
+		// Apply the modification on each item in the selector.
+		return this.each(function() {
+			var $this = $(this);
+			// build element specific options
+			var o = opts;
+			
+		 if (!o.alwaysBeat){
+			$this.bind("mouseover", function(){
+					// set the interval
+					// TODO
+				})
+				.bind("mouseout", function(){
+					// clear the interval
+					// TODO
+				});
+		 }
+		 else {
+			 var myThis = $(this);
+			 $.fn.heartBeat.start($(this), o);
+			 var intervalFct = function(){ $.fn.heartBeat.start(myThis, o); }; // Fix for setInterval bug between browser
+			 var intervalId = setInterval(intervalFct, o.delayBetweenAnimation + o.delay * 2);
+			 $(this).attr("intervalId", intervalId); 
+		 }
+			
+		});
+	};
+	
+	$.fn.heartBeat.start = function(thisItem, options) {
+		var opts = $.extend({}, $.fn.heartBeat.defaults, options);
+
+		if (thisItem.css("opacity") == opts.opacityMax){
+			thisItem.fadeTo(opts.delay, opts.opacityMin, function(){ thisItem.fadeTo(opts.delay, opts.opacityMax); });
+		}
+	};
+	
+	$.fn.heartBeat.stopHeartBeat = function(options){
+		// Stop the heart beat.
+		return this.each(function() {
+			var intervalId = $(this).attr("intervalId");
+			clearInterval(intervalId);
+			$(this).attr("intervalId", 0);
+		});
+	}
+
+	$.fn.heartBeat.defaults = {
+		opacityMax: "1",
+		opacityMin: "0.5",
+		delay:"75", // in ms
+		delayBetweenAnimation: 1000,
+		alwaysBeat: true
+	};
+	
+ })(jQuery);
\ No newline at end of file

Modified: zen-tts/template.php
===================================================================
--- zen-tts/template.php	2011-05-31 19:11:01 UTC (rev 65)
+++ zen-tts/template.php	2011-05-31 22:05:10 UTC (rev 66)
@@ -129,6 +129,7 @@
 
   drupal_add_css(drupal_get_path('theme', 'tts') .'/voicemap.css');
   drupal_add_js(drupal_get_path('theme', 'tts') .'/voicemap.js');
+  drupal_add_js(drupal_get_path('theme', 'tts') .'/jquery.nordz.heartBeat.js');
 
 
   $voicemap_constants = array(

Modified: zen-tts/voicemap.js
===================================================================
--- zen-tts/voicemap.js	2011-05-31 19:11:01 UTC (rev 65)
+++ zen-tts/voicemap.js	2011-05-31 22:05:10 UTC (rev 66)
@@ -15,9 +15,13 @@
   function hide_text(id) {
     $('#text' + id).slideUp('slow');
   }
+    
+  $("#pin0").heartBeat(
+    {
+      delayBetweenAnimation:1000, // Delay in ms between fade in and fade out. 
+	delay:500 // Time it take to do the fading animation.
+    });    
 
-
-
   $('.buble-img').mouseover(function(e) {
       var elem = $(this);
       var id = parseInt(elem.attr('id').substr(3));




More information about the Tts-dev-commits mailing list