2015-05-10 13:37:42 +09:00
|
|
|
/**
|
|
|
|
* A dictionnary of all the elements that use custom colors
|
|
|
|
*/
|
2015-05-18 11:39:12 +09:00
|
|
|
|
|
|
|
Telescope.colorElements = {};
|
|
|
|
|
|
|
|
Telescope.colorElements.colorTable = {
|
2015-04-22 07:50:11 +09:00
|
|
|
accentColor: [],
|
|
|
|
accentContrastColor: [],
|
|
|
|
secondaryColor: [],
|
|
|
|
secondaryContrastColor: []
|
2015-05-01 18:22:00 +02:00
|
|
|
};
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-05-10 13:37:42 +09:00
|
|
|
/**
|
|
|
|
* Register an element to use a custom color
|
|
|
|
* @param {string} selector - the CSS selector of the element
|
|
|
|
* @param {string} color - the color. Either `accentColor`, `accentContrastColor`, `secondaryColor`, or `secondaryContrastColor`
|
|
|
|
* @param {string} [property=color] - the property to colorize. Usually `color`, `background-color`, `border-color`, etc.
|
|
|
|
*/
|
2015-05-18 11:39:12 +09:00
|
|
|
Telescope.colorElements.add = function (selector, color, property) {
|
2015-04-22 07:50:11 +09:00
|
|
|
var element = {selector: selector};
|
|
|
|
|
|
|
|
if (typeof property !== "undefined")
|
2015-05-01 18:22:00 +02:00
|
|
|
element.property = property;
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-05-18 11:39:12 +09:00
|
|
|
Telescope.colorElements.colorTable[color].push(element);
|
2015-05-01 18:22:00 +02:00
|
|
|
};
|
2015-04-22 07:50:11 +09:00
|
|
|
|
|
|
|
// shortcuts
|
2015-05-01 18:22:00 +02:00
|
|
|
var setShortcut = function(name) {
|
|
|
|
return function (selector, property) {
|
2015-05-18 11:39:12 +09:00
|
|
|
Telescope.colorElements.add(selector, name, property);
|
2015-05-01 18:22:00 +02:00
|
|
|
};
|
|
|
|
};
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-05-01 18:22:00 +02:00
|
|
|
var accent = setShortcut('accentColor');
|
|
|
|
var accentContrast = setShortcut('accentContrastColor');
|
|
|
|
var secondary = setShortcut('secondaryColor');
|
|
|
|
var secondaryContrast = setShortcut('secondaryContrastColor');
|
2015-04-22 07:50:11 +09:00
|
|
|
|
|
|
|
// accentColor
|
|
|
|
|
|
|
|
accent("a:hover");
|
|
|
|
accent(".post-content .post-heading .post-title:hover");
|
2015-06-18 16:46:45 +09:00
|
|
|
accent(".post-vote .upvoted .upvote-link");
|
|
|
|
accent(".post-vote .downvoted .downvote-link");
|
2015-06-19 15:30:31 +09:00
|
|
|
accent(".upvoted .upvote");
|
|
|
|
accent(".downvoted .downvote");
|
2015-04-22 07:50:11 +09:00
|
|
|
accent(".toggle-actions-link");
|
|
|
|
accent(".post-meta a:hover");
|
|
|
|
accent(".action:hover");
|
|
|
|
accent(".post-actions .icon");
|
|
|
|
accent(".post-share .icon-share");
|
|
|
|
|
|
|
|
accent('input[type="submit"]', 'background-color');
|
|
|
|
accent("button", 'background-color');
|
|
|
|
accent(".button", 'background-color');
|
|
|
|
accent(".auth-buttons #login-buttons #login-buttons-password", 'background-color');
|
|
|
|
accent(".btn-primary", 'background-color');
|
|
|
|
accent(".header .btn-primary", 'background-color');
|
|
|
|
accent(".header .btn-primary:link", 'background-color');
|
|
|
|
accent(".header .btn-primary:visited", 'background-color');
|
|
|
|
accent(".error", 'background-color');
|
|
|
|
accent(".mobile-menu-button", 'background-color');
|
|
|
|
accent(".login-link-text", 'background-color');
|
|
|
|
accent(".post-category:hover", 'background-color');
|
|
|
|
|
|
|
|
accent(".icon-more", "border-color");
|
|
|
|
|
|
|
|
// accentContrastColor
|
|
|
|
|
|
|
|
accentContrast('input[type="submit"]');
|
|
|
|
accentContrast("button");
|
|
|
|
accentContrast(".button");
|
|
|
|
accentContrast(".auth-buttons #login-buttons #login-buttons-password");
|
|
|
|
accentContrast(".btn-primary");
|
|
|
|
accentContrast(".header .btn-primary");
|
|
|
|
accentContrast(".header .btn-primary:link");
|
|
|
|
accentContrast(".header .btn-primary:visited");
|
|
|
|
accentContrast(".error");
|
|
|
|
accentContrast(".header a.mobile-menu-button");
|
|
|
|
accentContrast("login-link-text");
|
|
|
|
accentContrast(".post-category:hover");
|
|
|
|
|
|
|
|
// secondaryColor
|
|
|
|
|
|
|
|
secondary(".header", "background-color");
|
|
|
|
|
|
|
|
// secondaryContrastColor
|
|
|
|
|
|
|
|
secondaryContrast(".header");
|
|
|
|
secondaryContrast(".header .logo a");
|
|
|
|
secondaryContrast(".header .logo a:visited");
|
|
|
|
|
|
|
|
secondaryContrast(".header .dropdown-top-level", "border-color");
|
|
|
|
secondaryContrast(".header .dropdown-accordion .show-more", "border-color");
|