Changeset 870528
- Timestamp:
- 03/06/2014 11:31:45 AM (12 years ago)
- Location:
- show-stock-quotes/trunk
- Files:
-
- 4 edited
-
include/js/kjb_quotes.js (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
-
show_stock_quotes.php (modified) (4 diffs)
-
uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
show-stock-quotes/trunk/include/js/kjb_quotes.js
r869077 r870528 8 8 jQuery(document).ready(function($) { 9 9 10 if (typeof( stock_array) != "undefined" && stock_array!== null) {11 for (var i = 0; i < stock_array.length; i++) {10 if (typeof(passed_data) != "undefined" && passed_data !== null) { 11 for (var i = 0; i < passed_data.out.length; i++) { 12 12 13 13 var url = "http://query.yahooapis.com/v1/public/yql"; 14 var data = encodeURIComponent("select * from yahoo.finance.quotes where symbol in ('" + stock_array[i] + "')");14 var data = encodeURIComponent("select * from yahoo.finance.quotes where symbol in ('" + passed_data.out[i] + "')"); 15 15 16 16 $.getJSON(url, 'q=' + data + "&format=json&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env") … … 23 23 24 24 if (data.query.results.quote.Change <= 0) { 25 $(".kjb_show_stock_quotes_quote_" + data.query.results.quote.Symbol).attr('style', 'border: none; color:red; text-align:right'); 25 if (passed_data.quote_display_color == 'change') { 26 $(".kjb_show_stock_quotes_quote_" + data.query.results.quote.Symbol).attr('style', 'border: none; color:red; text-align:right'); 27 }else { 28 $(".kjb_show_stock_quotes_quote_" + data.query.results.quote.Symbol).attr('style', 'border: none; text-align:right'); 29 } 30 26 31 $(".kjb_show_stock_quotes_change_" + data.query.results.quote.Symbol).attr('style', 'border: none; color:red; text-align:right'); 27 32 }else{ 28 $(".kjb_show_stock_quotes_quote_" + data.query.results.quote.Symbol).attr('style', 'border: none;color:green; text-align:right'); 33 if (passed_data.quote_display_color == 'change') { 34 $(".kjb_show_stock_quotes_quote_" + data.query.results.quote.Symbol).attr('style', 'border: none;color:green; text-align:right'); 35 }else { 36 $(".kjb_show_stock_quotes_quote_" + data.query.results.quote.Symbol).attr('style', 'border: none; text-align:right'); 37 } 38 29 39 $(".kjb_show_stock_quotes_change_" + data.query.results.quote.Symbol).attr('style', 'border: none;color:green; text-align:right'); 30 40 } … … 37 47 38 48 if (data.query.results.quote.LastTradePriceOnly == 0) { 39 $(".kjb_show_stock_quotes_quote_" + data.query.results.quote.Symbol).attr('style', 'border: none;color:red; text-align:right'); 49 if (passed_data.quote_display_color == 'change') { 50 $(".kjb_show_stock_quotes_quote_" + data.query.results.quote.Symbol).attr('style', 'border: none;color:red; text-align:right'); 51 }else { 52 $(".kjb_show_stock_quotes_quote_" + data.query.results.quote.Symbol).attr('style', 'border: none; text-align:right'); 53 } 54 40 55 $(".kjb_show_stock_quotes_change_" + data.query.results.quote.Symbol).attr('style', 'border: none;color:red; text-align:right'); 41 56 $(".kjb_show_stock_quotes_quote_" + data.query.results.quote.Symbol).text('Invalid'); -
show-stock-quotes/trunk/readme.txt
r869077 r870528 31 31 == Changelog == 32 32 33 = 1.4 = 34 - Option to change price color from normal (same color as ticker) to same color as change (green or red). 35 33 36 = 1.3.1 = 34 37 - Rounds to the nearest second decimal place. -
show-stock-quotes/trunk/show_stock_quotes.php
r869077 r870528 4 4 Plugin URI: http://kylebenkapps.com/wordpress-plugins/ 5 5 Description: Show stock quotes updated in real-time. 6 Version: 1. 3.16 Version: 1.4 7 7 Author: Kyle Benk 8 8 Author URI: http://kylebenkapps.com … … 87 87 /** @see WP_Widget::update */ 88 88 function update($new_instance, $old_instance) { 89 $instance = $old_instance; 89 $instance = array(); 90 91 $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; 92 $instance['quote_display_color'] = ( ! empty( $new_instance['quote_display_color'] ) ) ? strip_tags( $new_instance['quote_display_color'] ) : ''; 90 93 91 94 foreach ($this->options as $val) { … … 105 108 } 106 109 110 if (isset($instance['quote_display_color'])){ 111 $quote_display_color = $instance['quote_display_color']; 112 }else{ 113 $quote_display_color = 'change'; 114 } 115 107 116 108 117 ?> 118 119 <!-- Title --> 120 109 121 <p> 110 <label for="<?php echo $this->get_field_name( 'title' ); ?>"><?php _e( 'Title' ); ?></label> 111 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> 112 <br /><br /> 113 <label>Stocks Tickers</label> 114 <ol> 115 116 <?php 117 for ($i = 1; $i < 21; $i++) { 118 $stock = isset($instance['stock_'.$i]) ? $instance['stock_'.$i] : ''; 122 <label for="<?php echo $this->get_field_name( 'title' ); ?>"><?php _e( 'Title' ); ?></label> 123 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> 124 </p> 125 126 <!-- Quote Display Color --> 127 128 <p> 129 <label><?php _e( 'Quote Display Color' ); ?></label><br/> 130 131 <input type="radio" id="<?php echo $this->get_field_id( 'quote_display_color' ); ?>" name="<?php echo $this->get_field_name( 'quote_display_color' ); ?>" value="black" <?php echo isset($quote_display_color) && $quote_display_color == 'black' ? "checked" : ""; ?>/><label><?php _e('Same as symbol'); ?></label><br/> 132 <input type="radio" id="<?php echo $this->get_field_id( 'quote_display_color' ); ?>" name="<?php echo $this->get_field_name( 'quote_display_color' ); ?>" value="change" <?php echo isset($quote_display_color) && $quote_display_color == 'change' ? "checked" : ""; ?>/><label><?php _e('Same as change color'); ?></label> 133 </p> 134 135 <!-- Stock Tickers --> 136 137 <p> 138 <label><?php _e( 'Stock Tickers' ); ?></label> 139 <ol> 140 141 <?php 142 for ($i = 1; $i < 21; $i++) { 143 $stock = isset($instance['stock_'.$i]) ? $instance['stock_'.$i] : ''; 144 ?> 145 <li><input class="widefat" id="<?php echo $this->get_field_id( 'stock_'.$i ); ?>" name="<?php echo $this->get_field_name( 'stock_'.$i); ?>" type="text" value="<?php echo esc_attr( $stock ); ?>" /></li> 146 <?php 147 } 119 148 ?> 120 <li><input class="widefat" id="<?php echo $this->get_field_id( 'stock_'.$i ); ?>" name="<?php echo $this->get_field_name( 'stock_'.$i); ?>" type="text" value="<?php echo esc_attr( $stock ); ?>" /></li> 121 <?php 122 } 123 ?> 124 </ol> 149 </ol> 125 150 </p> 126 151 <?php … … 162 187 } 163 188 164 wp_localize_script('kjb_quotes_js_src', 'stock_array', $out); 189 $passed_data = array( 190 'out' => $out, 191 'quote_display_color' => $ticker_info['quote_display_color'] 192 ); 193 194 wp_localize_script('kjb_quotes_js_src', 'passed_data', $passed_data); 165 195 166 196 -
show-stock-quotes/trunk/uninstall.php
r750206 r870528 1 1 <?php 2 2 if(!defined('WP_UNINSTALL_PLUGIN') ) 3 3 die(); 4 ?>
Note: See TracChangeset
for help on using the changeset viewer.