Commit b73d8872 authored by xjm's avatar xjm

Issue #2505721 by eiriksm, nod_, jhodgdon: JSDoc color module

parent 0e2ca036
......@@ -8,7 +8,12 @@
"use strict";
/**
* Displays farbtastic color selector and initialize color administration UI.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attach color selection behavior to relevant context.
*/
Drupal.behaviors.color = {
attach: function (context, settings) {
......@@ -95,10 +100,14 @@
* @function Drupal.color~shift_color
*
* @param {string} given
* @param {Array} ref1
* @param {Array} ref2
* A hex color code to shift.
* @param {Array.<number>} ref1
* First HSL color reference.
* @param {Array.<number>} ref2
* Second HSL color reference.
*
* @return {string}
* A hex color, shifted.
*/
function shift_color(given, ref1, ref2) {
var d;
......@@ -143,9 +152,14 @@
* Callback for Farbtastic when a new color is chosen.
*
* @param {HTMLElement} input
* The input element where the color is chosen.
* @param {string} color
* The color that was chosen through the input.
* @param {bool} propagate
* Whether or not to propagate the color to a locked pair value
* @param {bool} colorScheme
* Flag to indicate if the user is using a color scheme when changing
* the color.
*/
function callback(input, color, propagate, colorScheme) {
var matched;
......@@ -201,6 +215,7 @@
* Focuses Farbtastic on a particular field.
*
* @param {jQuery.Event} e
* The focus event on the field.
*/
function focus(e) {
var input = e.target;
......
......@@ -8,17 +8,27 @@
"use strict";
/**
* Namespace for color-related functionality for Drupal.
*
* @namespace
*/
Drupal.color = {
/**
* The callback for when the color preview has been attached.
*
* @param {Element} context
* The context to initiate the color behaviour.
* @param {object} settings
* Settings for the color functionality.
* @param {HTMLFormElement} form
* The form to initiate the color behaviour on.
* @param {object} farb
* The farbtastic object.
* @param {number} height
* Height of gradient.
* @param {number} width
* Width of gradient.
*/
callback: function (context, settings, form, farb, height, width) {
var accum;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment