WordPress.org

Ready to get started?Download WordPress

Forums

Flexi Quote Rotator
[resolved] Pause effect when the mouse hovers (8 posts)

  1. samnasr
    Member
    Posted 1 year ago #

    hi there i dont know any code ( php or javascipt) , im wondering if anybody is able to help me acheive pause mouse hover effect .
    Many thanks

    http://wordpress.org/extend/plugins/flexi-quote-rotator/

  2. samnasr
    Member
    Posted 1 year ago #

    nevermind

  3. Deyson
    Member
    Posted 1 year ago #

    How were you able to achieve this?

    Thank you. :)

  4. samnasr
    Member
    Posted 1 year ago #

    i edited one on the php files to have a navigation dots and pause hover effect. i can probably share it with you

  5. Deyson
    Member
    Posted 1 year ago #

    If you could share it with me it would be great! Thank you :)

  6. samnasr
    Member
    Posted 1 year ago #

    go to the plugin in your ftp or cpanel . Find wp-content\plugins\flexi-quote-rotator\classes\quote-rotator.class.php
    and replace all the code in this file with the code below

    <?php
    
    if( !class_exists('QuoteRotator') ) :
    
    class QuoteRotator
    
    {
    
    	var $tableName;
    
    	var $pluginPath;
    
    	var $currentVersion;
    
    	function QuoteRotator()
    
    	{
    
    		global $wpdb;
    
    		$this->currentVersion = '0.1';
    
    		$this->tableName = $wpdb->prefix . 'QuoteRotator';
    
    		$this->pluginPath = get_settings('siteurl') . '/wp-content/plugins/flexi-quote-rotator/';
    
    		$options = get_option('widgetQuoteRotator');
    
    		$options['version'] = $this->currentVersion;
    
    		update_option('widgetQuoteRotator', $options);
    
    	}
    
    	function createDatabaseTable()
    
    	{
    
    		global $wpdb;
    
    		$options = array();
    
    		$options['title'] = 'Quote Rotator';
    
    		$options['delay'] = 5;
    
    		$options['fade'] = 2;
    
    		$options['fontsize'] = 12;
    
    		$options['fontunit'] = 'px';
    
    		if( !get_option('widgetQuoteRotator') )
    
    		{
    
    			add_option('widgetQuoteRotator', $options);
    
    		}
    
    		if( $wpdb->get_var("SHOW TABLES LIKE <code>&quot; . $this->tableName . &quot;</code>") != $this->tableName)
    
    		{
    
    			$sql = "CREATE TABLE <code>&quot; . $wpdb->prefix . &quot;QuoteRotator</code> (<code>id</code> MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY, <code>quote</code> TEXT NULL);";
    
    			//$sql = "CREATE TABLE <code>&quot; . $this->tableName . &quot;</code> (<code>id</code> MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY, <code>quote</code> TEXT NULL);";
    
    			require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
    
    			dbDelta($sql);
    
    			$options['version'] = $this->currentVersion;
    
    		}
    
    		$sql = "ALTER TABLE <code>&quot; . $this->tableName . &quot;</code> ADD <code>author</code> VARCHAR(255) NOT NULL AFTER <code>quote</code>;";
    
    		$wpdb->query($sql);
    
    		$sql = "RENAME TABLE <code>wp_QuoteRotator</code> TO <code>$this->tableName</code>;";
    
    		$wpdb->query($sql);
    
    		$sql = "ALTER TABLE <code>&quot; . $this->tableName . &quot;</code> CHANGE <code>quote</code> <code>quote</code> TEXT NULL;";
    
    		$wpdb->query($sql);
    
    		update_option('widgetQuoteRotator', $options);
    
    		delete_option('widgetizeQuoteRotator');		
    
    	}
    
    	function deleteDatabaseTable()
    
    	{
    
    		delete_option('widgetQuoteRotator');
    
    		//global $wpdb;
    
    		//$sql = "DROP TABLE IF EXISTS " . $this->tableName . ";";	
    
    		//$wpdb->query($sql);
    
    	}
    
    	function addHeaderContent()
    
    	{
    
    		global $wpdb;
    
    		$delay = get_option('fqr_delay');
    
    		if (!isset($delay) || $delay == "") $delay = 5;
    
    		$fade = get_option('fqr_fade');
    
    		if (!isset($fade) || $fade == "") $fade = 2;
    
    		$fadeout = get_option('fqr_fadeout');
    
    		if (!isset($fadeout) || $fadeout == "") $fadeout = 0;
    
    		$random = get_option('fqr_random');
    
    		if (!isset($random) || $random == "") $random = 0;
    
    		$openquote = get_option('fqr_openquote');
    
    		if (!isset($openquote) || $openquote == "") {
    
             $openquote = "";
    
          } else {
    
             $openquote = "<span id='openquote' class='quotemark'>" . $openquote . '</span>';
    
          }
    
    		$closequote = get_option('fqr_closequote');
    
    		if (!isset($closequote) || $closequote == "") {
    
             $closequote = "";
    
          } else {
    
             $closequote = "<span id='closequote' class='quotemark'>" . $closequote . '</span>';
    
          }
    
    		if($random)
    
    			$sql = "SELECT * FROM " . $this->tableName . " ORDER BY RAND(".time().")";
    
    		else
    
    			$sql = "SELECT * FROM " . $this->tableName . " ORDER BY id";
    
    		$results = $wpdb->get_results($sql);
    
    		$stylesdir = 'wp-content/plugins/flexi-quote-rotator/styles/';
    
    		$cssfile = get_option('fqr_stylesheet');
    
          if (file_exists(ABSPATH . $stylesdir . $cssfile))
    
    		echo "
    
    			<link rel=\"stylesheet\" href=\"" . get_settings('siteurl') . '/' . $stylesdir . $cssfile ."\" type=\"text/css\" media=\"screen\" />";
    
    		/* 2010-03-25 replacing Scriptaculous animation code with jQuery - Thanks to colin@brainbits.ca for supplying the code */
    
    		echo "	<script type='text/javascript'>
    			(function ($) {
    				var callquote;
    
    				quoteRotator = {
    
    					i: 1,
    
    					quotes: [";
    
                   	$i=0;
    
                   	foreach($results as $result){
    
                           	echo "\"$openquote<span id='quote'>$result->quote</span>$closequote";
    
                           	if($result->author != '')
    
    				echo " <span id='quoteauthor'>$result->author</span>";
    
    			echo "\",\n";
    
    			$i++;
    
    		}
    
    		echo "
    
    					],
    
    					numQuotes: ".$i.",
    
    					fadeDuration: ".$fade.",
    
    					fadeoutDuration: ".$fadeout.",
    
    					delay: ".$delay.",
    
    					quotesInit: function(){
    
    						if (this.numQuotes < 1){
    
    							document.getElementById('quoterotator').innerHTML=\"No Quotes Found\";
    
    						} else {
    							this.navQuote();
    							this.quoteRotate();
    							this.quotehover();
    						}
    					},
    					navQuote: function() {
    						$('<div id=\"quotenav\"></div>').insertAfter('#quotearea');
    						for (n=1; n <= this.numQuotes ; n++) {
    							$('#quotenav').append('<span onclick=\"quoteRotator.callQuote(this,'+n+')\">&bull;</span>');
    						}
    						// insert style
    						$('head').append('<style type=\"text/css\">#quotenav {display: block;text-align: center;font-size: 50px;color: #000;}#quotenav span {margin: 0 3px;cursor: pointer;}#quotenav span.active,#quotenav span:hover{color: red;}</style>');
    					},
    					quoteRotate: function(i){
    						if(!i) {
    							i = this.i;
    						}
    						$('#quotenav span').each(function () {
    							$(this).removeClass('active');
    						});
    						$('#quotenav span:nth-child('+i+')').addClass('active');
    
    						jQuery('#quoterotator').hide().html(this.quotes[i - 1]).fadeIn(this.fadeDuration * 1000).css('filter','');
    
    						this.i = i % (this.numQuotes) + 1;
    
    						callquote = setTimeout('quoteRotator.quoteRotate()', (this.delay + this.fadeDuration) * 1000);
    
    					},
    					callQuote: function(e,n) {
    						clearTimeout(callquote);
    						this.quoteRotate(n);
    					},
    					quotehover: function() {
    						jQuery('#quotearea').mouseenter(function () {
    							clearTimeout(callquote);
    						  }).mouseleave(function(){
    								setTimeout('quoteRotator.quoteRotate()', 500);
    						  });
    					}
    				}
    		})(jQuery);
    			</script>";
    
    	}
    
    	function displayWidget($args)
    
    	{
    
    		extract($args);
    
    		$options = get_option('widgetQuoteRotator');
    
    		$title = $options['title'];
    
          $color = $options['color'];
    
          $style = "";
    
          if ($options['fontsize'] != "") $style .= "font-size:".$options['fontsize'].$options['fontunit'].";";
    
          if ($options['height'] != "") $style .= "height:".$options['height']."px;";
    
          if ($options['color'] != "") $style .= "color:".$options['color'].";";
    
          if ($style != "") $style = " style='".$style."'";
    
    		echo $before_widget . $before_title . $title . $after_title;
    
    		echo "<div id=\"quotearea\"$style><div id=\"quoterotator\">\n";
    
    		echo "Loading Quotes...\n";
    
    		echo "</div></div>\n";
    
    		echo "<script type=\"text/javascript\">setTimeout(\"quoteRotator.quotesInit()\", 2000)</script>\n";
    
    		echo $after_widget;
    
    	}
    
    	function getQuoteCode($title=null, $delay=null, $fadeDuration=null, $fadeoutDuration=null)
    
    	{
    
    		$output =  "";
    
          if (isset($title) && $title != "") {
    
       		$output .=  "<h2>" . $title . "</h2>";
    
    		} else {
    
             $title_from_settings = get_option('fqr_title');
    
             if (isset($title_from_settings) && $title_from_settings != "") {
    
          		$output .=  "<h2>" . $title_from_settings . "</h2>";
    
       		}
    
          }
    
          $style = "";
    
          if (get_option('fqr_height') != "") $style .= "height:".get_option('fqr_height')."px;";
    
          if (get_option('fqr_width') != "") $style .= "width:".get_option('fqr_width')."px;";
    
          if ($style != "") $style = " style='".$style."'";
    
    		$output .= "<div id=\"quotearea\"$style><div id=\"quoterotator\">\n";
    
    		$output .= "Loading Quotes...\n";
    
    		$output .= "</div></div>\n";
    
    		$output .= "<script type=\"text/javascript\">";
    
          if (isset($delay) && $delay != "") {
    
       		$output .=  "quoteRotator.delay=".$delay.";";
    
    		}
    
          if (isset($fadeDuration) && $fadeDuration != "") {
    
       		$output .=  "quoteRotator.fadeDuration=".$fadeDuration.";";
    
    		}
    
          if (isset($fadeoutDuration) && $fadeoutDuration != "") {
    
       		$output .=  "quoteRotator.fadeoutDuration=".$fadeoutDuration.";";
    
    		}
    
          $output .= "quoteRotator.quotesInit();</script>\n";
    
    		return $output;
    
    	}
    
    }
    
    endif;
    
    ?>
  7. Deyson
    Member
    Posted 1 year ago #

    Thank you very much!!! :)

  8. integritydesigns
    Member
    Posted 9 months ago #

    I added the above code and it kept giving me a glitch where the first quote would work fine but the second one would show and then quickly skip to the next one. Great idea though! I hadn't thought of being a helpful feature until I saw this support thread.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic