*/
function hsvToRgb(h, s, v) {
const rgb = { r: 0, g: 0, b: 0 };
- let h2, f, p, q, t;
- h2 = Math.floor(h / 60);
- f = h / 60 - h2;
+ const h2 = Math.floor(h / 60);
+ const f = h / 60 - h2;
s /= 100;
v /= 100;
- p = v * (1 - s);
- q = v * (1 - s * f);
- t = v * (1 - s * (1 - f));
+ const p = v * (1 - s);
+ const q = v * (1 - s * f);
+ const t = v * (1 - s * (1 - f));
if (s == 0) {
rgb.r = rgb.g = rgb.b = v;
}
* @see https://secure.wikimedia.org/wikipedia/de/wiki/HSV-Farbraum#Transformation_von_RGB_und_HSV
*/
function rgbToHsv(r, g, b) {
- let h, s, v;
- let max, min, diff;
+ let h, s;
r /= 255;
g /= 255;
b /= 255;
- max = Math.max(Math.max(r, g), b);
- min = Math.min(Math.min(r, g), b);
- diff = max - min;
+ const max = Math.max(Math.max(r, g), b);
+ const min = Math.min(Math.min(r, g), b);
+ const diff = max - min;
h = 0;
if (max !== min) {
switch (max) {
else {
s = diff / max;
}
- v = max;
+ const v = max;
return {
h: Math.round(h),
s: Math.round(s * 100),
* Recursively serializes an object into an encoded URI parameter string.
*/
function serialize(obj, prefix) {
- let parameters = [];
+ const parameters = [];
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
const parameterKey = prefix ? prefix + "[" + key + "]" : key;
if (attribute.name.indexOf(prefix) === 0) {
let name = attribute.name.replace(new RegExp("^" + prefix), "");
if (camelCaseName) {
- let tmp = name.split("-");
+ const tmp = name.split("-");
name = "";
for (let j = 0, innerLength = tmp.length; j < innerLength; j++) {
if (name.length) {
if (element.parentNode === null) {
throw new Error("The element has no parent.");
}
- let parent = element.parentNode;
+ const parent = element.parentNode;
while (element.childNodes.length) {
parent.insertBefore(element.childNodes[0], element);
}
Dialog_1.default.close(this);
}
_ajaxSuccess(data) {
- let html = data.returnValues
+ const html = data.returnValues
.map((article) => {
return `<li>
<div class="containerHeadline pointer" data-article-id="${article.articleID}">
})
.join("");
this.resultList.innerHTML = html;
- Util_1.default[html ? "show" : "hide"](this.resultList);
+ if (html) {
+ Util_1.default.show(this.resultList);
+ }
+ else {
+ Util_1.default.hide(this.resultList);
+ }
if (html) {
this.resultList.querySelectorAll(".containerHeadline").forEach((item) => {
item.addEventListener("click", this.click.bind(this));
return true;
}
let active;
- let i = 0, length = this.dropdownMenu.childElementCount;
+ let i = 0;
+ const length = this.dropdownMenu.childElementCount;
while (i < length) {
active = this.dropdownMenu.children[i];
if (active.classList.contains("active")) {
*/
export function hsvToRgb(h: number, s: number, v: number): RGB {
const rgb: RGB = { r: 0, g: 0, b: 0 };
- let h2: number, f: number, p: number, q: number, t: number;
- h2 = Math.floor(h / 60);
- f = h / 60 - h2;
+ const h2 = Math.floor(h / 60);
+ const f = h / 60 - h2;
s /= 100;
v /= 100;
- p = v * (1 - s);
- q = v * (1 - s * f);
- t = v * (1 - s * (1 - f));
+ const p = v * (1 - s);
+ const q = v * (1 - s * f);
+ const t = v * (1 - s * (1 - f));
if (s == 0) {
rgb.r = rgb.g = rgb.b = v;
* @see https://secure.wikimedia.org/wikipedia/de/wiki/HSV-Farbraum#Transformation_von_RGB_und_HSV
*/
export function rgbToHsv(r: number, g: number, b: number): HSV {
- let h: number, s: number, v: number;
- let max: number, min: number, diff: number;
+ let h: number, s: number;
r /= 255;
g /= 255;
b /= 255;
- max = Math.max(Math.max(r, g), b);
- min = Math.min(Math.min(r, g), b);
- diff = max - min;
+ const max = Math.max(Math.max(r, g), b);
+ const min = Math.min(Math.min(r, g), b);
+ const diff = max - min;
h = 0;
if (max !== min) {
s = diff / max;
}
- v = max;
+ const v = max;
return {
h: Math.round(h),
* Recursively serializes an object into an encoded URI parameter string.
*/
export function serialize(obj: object, prefix?: string): string {
- let parameters: string[] = [];
+ const parameters: string[] = [];
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
if (attribute.name.indexOf(prefix) === 0) {
let name = attribute.name.replace(new RegExp("^" + prefix), "");
if (camelCaseName) {
- let tmp = name.split("-");
+ const tmp = name.split("-");
name = "";
for (let j = 0, innerLength = tmp.length; j < innerLength; j++) {
if (name.length) {
throw new Error("The element has no parent.");
}
- let parent = element.parentNode;
+ const parent = element.parentNode;
while (element.childNodes.length) {
parent.insertBefore(element.childNodes[0], element);
}
}
_ajaxSuccess(data: AjaxResponse): void {
- let html = data.returnValues
+ const html = data.returnValues
.map((article) => {
return `<li>
<div class="containerHeadline pointer" data-article-id="${article.articleID}">
this.resultList!.innerHTML = html;
- DomUtil[html ? "show" : "hide"](this.resultList!);
+ if (html) {
+ DomUtil.show(this.resultList!);
+ } else {
+ DomUtil.hide(this.resultList!);
+ }
if (html) {
this.resultList!.querySelectorAll(".containerHeadline").forEach((item) => {
}
let active!: HTMLElement;
- let i = 0,
- length = this.dropdownMenu!.childElementCount;
+ let i = 0;
+ const length = this.dropdownMenu!.childElementCount;
while (i < length) {
active = this.dropdownMenu!.children[i] as HTMLElement;
if (active.classList.contains("active")) {