Consistency.
This commit is contained in:
parent
fadb3aa10d
commit
574070d546
@ -13319,7 +13319,7 @@
|
|||||||
return Style.sheets.padding.textContent = ("body { padding-bottom: 15px; padding-top: 15px; } .fourchan-ss-navigation.fixed.top-header:not(.autohide) body::before { top: " + navHeight + "px; } .fourchan-ss-navigation.fixed.bottom-header:not(.autohide) body::before { bottom: " + navHeight + "px; } .top-header:not(.autohide) body { padding-top: " + (navHeight + 1) + "px; } .bottom-header:not(.autohide) body { padding-bottom: " + (navHeight + 1) + "px; } ") + (pageHeight ? ".fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { top: " + pageHeight + "px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { bottom: " + pageHeight + "px; } .index.pagination-sticky-top body, .index.pagination-top body { padding-top: " + (pageHeight + 1) + "px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { padding-bottom: " + (pageHeight + 1) + "px; }" : '');
|
return Style.sheets.padding.textContent = ("body { padding-bottom: 15px; padding-top: 15px; } .fourchan-ss-navigation.fixed.top-header:not(.autohide) body::before { top: " + navHeight + "px; } .fourchan-ss-navigation.fixed.bottom-header:not(.autohide) body::before { bottom: " + navHeight + "px; } .top-header:not(.autohide) body { padding-top: " + (navHeight + 1) + "px; } .bottom-header:not(.autohide) body { padding-bottom: " + (navHeight + 1) + "px; } ") + (pageHeight ? ".fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { top: " + pageHeight + "px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { bottom: " + pageHeight + "px; } .index.pagination-sticky-top body, .index.pagination-top body { padding-top: " + (pageHeight + 1) + "px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { padding-bottom: " + (pageHeight + 1) + "px; }" : '');
|
||||||
},
|
},
|
||||||
color: (function() {
|
color: (function() {
|
||||||
var calc_rgb, colorToHex, minmax;
|
var calcRGB, colorToHex, minmax;
|
||||||
|
|
||||||
minmax = function(base) {
|
minmax = function(base) {
|
||||||
if (base < 0) {
|
if (base < 0) {
|
||||||
@ -13331,7 +13331,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
calc_rgb = function(value) {
|
calcRGB = function(value) {
|
||||||
var hex;
|
var hex;
|
||||||
hex = parseInt(value, 16);
|
hex = parseInt(value, 16);
|
||||||
return [(hex >> 16) & 0xFF, (hex >> 8) & 0xFF, hex & 0xFF];
|
return [(hex >> 16) & 0xFF, (hex >> 8) & 0xFF, hex & 0xFF];
|
||||||
@ -13377,12 +13377,12 @@
|
|||||||
return "#" + this.raw;
|
return "#" + this.raw;
|
||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.private_rgb = function() {
|
_Class.prototype.privateRGB = function() {
|
||||||
return calc_rgb(this.raw);
|
return calc_rgb(this.raw);
|
||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.rgb = function() {
|
_Class.prototype.rgb = function() {
|
||||||
return this.private_rgb().join("");
|
return this.privateRGB().join("");
|
||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.hover = function() {
|
_Class.prototype.hover = function() {
|
||||||
@ -13390,24 +13390,24 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.isLight = function() {
|
_Class.prototype.isLight = function() {
|
||||||
var rgb;
|
return (this.privateRGB[0] * 0.299 + this.privateRGB[1] * 0.587 + this.privateRGB[2] * 0.114) > 125;
|
||||||
rgb = this.private_rgb;
|
|
||||||
return (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.shiftRGB = function(shift, smart) {
|
_Class.prototype.shiftRGB = function(shift, smart) {
|
||||||
var color, rgb;
|
var color;
|
||||||
rgb = __slice.call(this.private_rgb);
|
if (smart) {
|
||||||
shift = smart ? (this.isLight ? -1 : 1) * Math.abs(shift) : shift;
|
shift = (this.isLight ? -1 : 1) * Math.abs(shift);
|
||||||
|
}
|
||||||
return ((function() {
|
return ((function() {
|
||||||
var _i, _len, _results;
|
var _i, _len, _ref, _results;
|
||||||
|
_ref = this.privateRGB;
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = rgb.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
color = rgb[_i];
|
color = _ref[_i];
|
||||||
_results.push(minmax(color + shift));
|
_results.push(minmax(color + shift));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
})()).join(",");
|
}).call(this)).join(",");
|
||||||
};
|
};
|
||||||
|
|
||||||
return _Class;
|
return _Class;
|
||||||
|
|||||||
@ -13330,7 +13330,7 @@
|
|||||||
return Style.sheets.padding.textContent = ("body { padding-bottom: 15px; padding-top: 15px; } .fourchan-ss-navigation.fixed.top-header:not(.autohide) body::before { top: " + navHeight + "px; } .fourchan-ss-navigation.fixed.bottom-header:not(.autohide) body::before { bottom: " + navHeight + "px; } .top-header:not(.autohide) body { padding-top: " + (navHeight + 1) + "px; } .bottom-header:not(.autohide) body { padding-bottom: " + (navHeight + 1) + "px; } ") + (pageHeight ? ".fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { top: " + pageHeight + "px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { bottom: " + pageHeight + "px; } .index.pagination-sticky-top body, .index.pagination-top body { padding-top: " + (pageHeight + 1) + "px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { padding-bottom: " + (pageHeight + 1) + "px; }" : '');
|
return Style.sheets.padding.textContent = ("body { padding-bottom: 15px; padding-top: 15px; } .fourchan-ss-navigation.fixed.top-header:not(.autohide) body::before { top: " + navHeight + "px; } .fourchan-ss-navigation.fixed.bottom-header:not(.autohide) body::before { bottom: " + navHeight + "px; } .top-header:not(.autohide) body { padding-top: " + (navHeight + 1) + "px; } .bottom-header:not(.autohide) body { padding-bottom: " + (navHeight + 1) + "px; } ") + (pageHeight ? ".fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { top: " + pageHeight + "px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { bottom: " + pageHeight + "px; } .index.pagination-sticky-top body, .index.pagination-top body { padding-top: " + (pageHeight + 1) + "px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { padding-bottom: " + (pageHeight + 1) + "px; }" : '');
|
||||||
},
|
},
|
||||||
color: (function() {
|
color: (function() {
|
||||||
var calc_rgb, colorToHex, minmax;
|
var calcRGB, colorToHex, minmax;
|
||||||
|
|
||||||
minmax = function(base) {
|
minmax = function(base) {
|
||||||
if (base < 0) {
|
if (base < 0) {
|
||||||
@ -13342,7 +13342,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
calc_rgb = function(value) {
|
calcRGB = function(value) {
|
||||||
var hex;
|
var hex;
|
||||||
hex = parseInt(value, 16);
|
hex = parseInt(value, 16);
|
||||||
return [(hex >> 16) & 0xFF, (hex >> 8) & 0xFF, hex & 0xFF];
|
return [(hex >> 16) & 0xFF, (hex >> 8) & 0xFF, hex & 0xFF];
|
||||||
@ -13388,12 +13388,12 @@
|
|||||||
return "#" + this.raw;
|
return "#" + this.raw;
|
||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.private_rgb = function() {
|
_Class.prototype.privateRGB = function() {
|
||||||
return calc_rgb(this.raw);
|
return calc_rgb(this.raw);
|
||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.rgb = function() {
|
_Class.prototype.rgb = function() {
|
||||||
return this.private_rgb().join("");
|
return this.privateRGB().join("");
|
||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.hover = function() {
|
_Class.prototype.hover = function() {
|
||||||
@ -13401,24 +13401,24 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.isLight = function() {
|
_Class.prototype.isLight = function() {
|
||||||
var rgb;
|
return (this.privateRGB[0] * 0.299 + this.privateRGB[1] * 0.587 + this.privateRGB[2] * 0.114) > 125;
|
||||||
rgb = this.private_rgb;
|
|
||||||
return (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.shiftRGB = function(shift, smart) {
|
_Class.prototype.shiftRGB = function(shift, smart) {
|
||||||
var color, rgb;
|
var color;
|
||||||
rgb = __slice.call(this.private_rgb);
|
if (smart) {
|
||||||
shift = smart ? (this.isLight ? -1 : 1) * Math.abs(shift) : shift;
|
shift = (this.isLight ? -1 : 1) * Math.abs(shift);
|
||||||
|
}
|
||||||
return ((function() {
|
return ((function() {
|
||||||
var _i, _len, _results;
|
var _i, _len, _ref, _results;
|
||||||
|
_ref = this.privateRGB;
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = rgb.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
color = rgb[_i];
|
color = _ref[_i];
|
||||||
_results.push(minmax(color + shift));
|
_results.push(minmax(color + shift));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
})()).join(",");
|
}).call(this)).join(",");
|
||||||
};
|
};
|
||||||
|
|
||||||
return _Class;
|
return _Class;
|
||||||
|
|||||||
@ -210,7 +210,7 @@ Style =
|
|||||||
color: class
|
color: class
|
||||||
minmax = (base) -> if base < 0 then 0 else if base > 255 then 255 else base
|
minmax = (base) -> if base < 0 then 0 else if base > 255 then 255 else base
|
||||||
|
|
||||||
calc_rgb = (value) ->
|
calcRGB = (value) ->
|
||||||
hex = parseInt value, 16
|
hex = parseInt value, 16
|
||||||
return [ # 0xRRGGBB to [R, G, B]
|
return [ # 0xRRGGBB to [R, G, B]
|
||||||
(hex >> 16) & 0xFF
|
(hex >> 16) & 0xFF
|
||||||
@ -254,19 +254,12 @@ Style =
|
|||||||
constructor: (value) ->
|
constructor: (value) ->
|
||||||
@raw = colorToHex value
|
@raw = colorToHex value
|
||||||
|
|
||||||
hex: -> "#" + @raw
|
hex: -> "#" + @raw
|
||||||
private_rgb: -> calc_rgb @raw
|
privateRGB: -> calc_rgb @raw
|
||||||
rgb: -> @private_rgb().join ""
|
rgb: -> @privateRGB().join ""
|
||||||
hover: -> @shiftRGB 16, true
|
hover: -> @shiftRGB 16, true
|
||||||
isLight: ->
|
isLight: -> (@privateRGB[0] * 0.299 + @privateRGB[1] * 0.587 + @privateRGB[2] * 0.114) > 125
|
||||||
rgb = @private_rgb
|
|
||||||
(rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125
|
|
||||||
|
|
||||||
shiftRGB: (shift, smart) ->
|
shiftRGB: (shift, smart) ->
|
||||||
rgb = [@private_rgb...]
|
shift = (if @isLight then -1 else 1) * Math.abs shift if smart
|
||||||
shift = if smart
|
return (minmax color + shift for color in @privateRGB).join ","
|
||||||
(if @isLight then -1 else 1) * Math.abs shift
|
|
||||||
else
|
|
||||||
shift
|
|
||||||
|
|
||||||
return (minmax color + shift for color in rgb).join ","
|
|
||||||
Loading…
x
Reference in New Issue
Block a user