[Logilogi-svn] SF.net SVN: logilogi:[1781] trunk
Status: Beta
Brought to you by:
wybow
|
From: <wy...@us...> - 2011-01-04 21:21:25
|
Revision: 1781
http://logilogi.svn.sourceforge.net/logilogi/?rev=1781&view=rev
Author: wybow
Date: 2011-01-04 21:21:19 +0000 (Tue, 04 Jan 2011)
Log Message:
-----------
Cleanup of magick corners, temporarily disabled mailers
Modified Paths:
--------------
trunk/lib/tasks/daemons.rake
trunk/public/javascripts/magick_corners.js
Modified: trunk/lib/tasks/daemons.rake
===================================================================
--- trunk/lib/tasks/daemons.rake 2010-12-21 15:26:45 UTC (rev 1780)
+++ trunk/lib/tasks/daemons.rake 2011-01-04 21:21:19 UTC (rev 1781)
@@ -47,7 +47,7 @@
PeerGroupMembership.drop_the_powerless
if GlobalConfig.use_log_log
- LogLogSubscription.send_out_alerts('daily')
+# LogLogSubscription.send_out_alerts('daily')
end
ActiveRecord::Base.logger.info "Daily finished at #{Time.now}.\n"
@@ -60,7 +60,7 @@
ActiveRecord::Base.logger.info "Weekly started at #{Time.now}.\n"
if GlobalConfig.use_log_log
- LogLogSubscription.send_out_alerts('weekly')
+# LogLogSubscription.send_out_alerts('weekly')
end
ActiveRecord::Base.logger.info "Weekly finished at #{Time.now}.\n"
Modified: trunk/public/javascripts/magick_corners.js
===================================================================
--- trunk/public/javascripts/magick_corners.js 2010-12-21 15:26:45 UTC (rev 1780)
+++ trunk/public/javascripts/magick_corners.js 2011-01-04 21:21:19 UTC (rev 1781)
@@ -16,7 +16,7 @@
*/
Prototype.Browser.IE6 = Prototype.Browser.IE &&
- parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE") + 5)) == 6;
+ parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE") + 5), 10) == 6;
var MagickCorners = Class.create({
// // Constants
@@ -34,25 +34,26 @@
initialize: function(args) {
options = new Hash(args);
- if (options != null) {
+ if (options !== null) {
this.path_prefix = options.unset('path_prefix');
}
if (options.keys.size > 0) {
alert('Misspelled option given');
}
- this.path_prefix = this.path_prefix != null ? this.path_prefix + '/' : ''
+ this.path_prefix = this.path_prefix !== null ? this.path_prefix + '/' : '';
},
// // Public Methods
add: function(selector, args) {
+ var options = null;
// not (yet) working in Opera and Safari
if (Prototype.Browser.Opera || Prototype.Browser.MobileSafari) {
return;
}
// // Harvest config variables
- var options = this.harvest_args(args);
+ options = this.harvest_args(args);
this.add_run('mcdone', [selector, options]);
@@ -124,32 +125,34 @@
},
now_to_element: function(element, options, done_tag) {
+ var element_vars, css_options, image_size, outer_css_options,
+ stretch_css_options, format, image_url, outer_element,
+ stretch_element, tempClassName;
if (this.not_done(element, done_tag)) {
- var element_vars = this.get_element_vars(element, options);
+ element_vars = this.get_element_vars(element, options);
// // Prepare the options
- var css_options = new Hash();
+ css_options = new Hash();
//css_options.set('overflow', 'auto');
css_options.set('backgroundRepeat', 'no-repeat');
- var image_size = this.get_image_size(options, element_vars);
+ image_size = this.get_image_size(options, element_vars);
if (options.stretch_side != 'none') {
- var outer_css_options = new Hash();
- var stretch_css_options = new Hash();
+ outer_css_options = new Hash();
+ stretch_css_options = new Hash();
this.prepare_options_for_stretch(css_options, outer_css_options, stretch_css_options,
options, element_vars, image_size);
}
// // Set the image url
- var format = 'png';
- var image_url;
- if (options.scaled_image != null ) {
+ format = 'png';
+ if (options.scaled_image !== null ) {
image_url = 'url(/' + this.path_prefix + 'magick_corners/scaled_image.' +
image_size.limit + '.' + options.scaled_dimension +
'.' + options.scaled_image + '.' + format + ')';
} else {
- if (options.image != null) {
+ if (options.image !== null) {
image_url = 'url(/' + this.path_prefix + 'magick_corners/image.' + image_size.width + '.' + image_size.height +
'.' + options.image + '.' + options.corner_size + '.' +
options.image_start_corner + '.' + format + ')';
@@ -166,9 +169,6 @@
}
if (options.stretch_side != 'none') {
- // // Create new elements
- var outer_element, stretch_element;
-
// Create the new outer-element
outer_element = new Element('div');
if (element.getAttribute('id')) {
@@ -188,7 +188,7 @@
}
});
- var tempClassName = element.className;
+ tempClassName = element.className;
element.setAttribute('class','');
element.className = '';
// The mcdone is needed to prevent double borders
@@ -215,13 +215,18 @@
}
element.setStyle2(css_options);
if (options.stretch_side != 'none') {
- stretch_element.setStyle2(stretch_css_options)
+ stretch_element.setStyle2(stretch_css_options);
}
}
},
prepare_options_for_stretch: function(css_options, outer_css_options, stretch_css_options,
options, element_vars, image_size) {
+ var remaining_adjustment = 0,
+ stretch_sides = ['top', 'right', 'bottom', 'left'], // same order
+ stretch_side_index = stretch_sides.indexOf(options.stretch_side),
+ new_stretch_padding = element_vars.full_padding_values[stretch_side_index] - image_size.corner_size;
+
// block and overflow
outer_css_options.set('display', 'block');
//outer_css_options.set('overflow', 'auto');
@@ -241,14 +246,6 @@
outer_css_options.set('width', element_vars.full_width + 'px');
outer_css_options.set('height', element_vars.full_height + 'px');
- // // Settings dependent on side
-
- // padding adjustment
- var remaining_adjustment = 0;
- var stretch_sides = ['top', 'right', 'bottom', 'left']; // same order as padding sides
- var stretch_side_index = stretch_sides.indexOf(options.stretch_side);
-
- var new_stretch_padding = element_vars.full_padding_values[stretch_side_index] - image_size.corner_size;
if (new_stretch_padding < 0) {
remaining_adjustment = new_stretch_padding * -1;
new_stretch_padding = 0;
@@ -299,11 +296,11 @@
width = element_vars.full_width;
height = element_vars.full_height;
}
- if (options.scaled_image != null) {
+ if (options.scaled_image !== null) {
if (options.scaled_dimension == 'height') {
- limit = height
+ limit = height;
} else {
- limit = width
+ limit = width;
}
corner_size = Math.floor((limit / options.reference_size) * options.corner_size);
} else {
@@ -318,7 +315,7 @@
harvest_args: function(args) {
var corner_size, stretch_side, image, image_start_corner;
options = new Hash(args);
- if (options != null) {
+ if (options !== null) {
// image and box settings
corner_size = options.unset('corner_size');
stretch_side = options.unset('stretch_side');
@@ -328,18 +325,18 @@
image_start_corner = options.unset('image_start_corner');
// scaled image settings
- reference_size = options.unset('reference_size')
+ reference_size = options.unset('reference_size');
scaled_image = options.unset('scaled_image');
- scaled_dimension = options.unset('scaled_dimension')
+ scaled_dimension = options.unset('scaled_dimension');
}
if (options.keys.size > 0) {
alert('Misspelled option given');
}
- corner_size = corner_size != null ? corner_size : this.DefaultCornerSize;
- stretch_side = stretch_side != null ? stretch_side : 'bottom';
- image_start_corner = image_start_corner != null ? image_start_corner : 'north_west';
- reference_size = reference_size != null ? reference_size : 40;
- scaled_dimension = scaled_dimension != null ? scaled_dimension : 'height';
+ corner_size = corner_size !== null ? corner_size : this.DefaultCornerSize;
+ stretch_side = stretch_side !== null ? stretch_side : 'bottom';
+ image_start_corner = image_start_corner !== null ? image_start_corner : 'north_west';
+ reference_size = reference_size !== null ? reference_size : 40;
+ scaled_dimension = scaled_dimension !== null ? scaled_dimension : 'height';
return {corner_size : corner_size,
stretch_side : stretch_side,
@@ -352,7 +349,7 @@
get_element_vars: function(element, options) {
var full_width, full_height, width, height,
- background_color, border_width, border_color, full_padding_values
+ background_color, border_width, border_color, full_padding_values;
// // Get the current sizes and colors
full_width = element.getWidth();
full_height = element.getHeight();
@@ -363,8 +360,7 @@
background_color = this.get_color_style(element, 'backgroundColor');
border_width = this.get_int_style(element, 'borderTopWidth');
- border_color;
- if (!isNaN(border_width) && (border_width != 0)) {
+ if (!isNaN(border_width) && (border_width !== 0)) {
border_color = this.get_color_style(element, 'borderTopColor');
} else {
border_width = 0;
@@ -408,11 +404,11 @@
},
get_int_style: function(outer_element, style) {
- var str = outer_element.getStyle(style)
+ var str = outer_element.getStyle(style);
if (str.match(/em/)) {
- return parseInt(parseFloat(str.gsub('em','')) * this.Emsize);
+ return parseInt(parseFloat(str.gsub('em','')) * this.Emsize, 10);
} else {
- return parseInt(parseFloat(str.gsub('px','')));
+ return parseInt(parseFloat(str.gsub('px','')), 10);
}
},
@@ -423,16 +419,16 @@
var arr = str.split(', ');
return this.to_hex(arr[0]) + this.to_hex(arr[1]) + this.to_hex(arr[2]);
} else {
- return str
+ return str;
}
},
to_hex: function(N) {
- if (N == null) {
+ if (N === null) {
return "00";
}
- N = parseInt(N);
- if (N == 0 || isNaN(N)) {
+ N = parseInt(N, 10);
+ if (N === 0 || isNaN(N)) {
return "00";
}
N = Math.max(0,N);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|