From 29f1297649ec616bbdaeda7a27d6eb0439a198bf Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Sat, 1 Feb 2020 22:41:50 +0100 Subject: [PATCH] put some code into a function --- www/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/www/index.js b/www/index.js index b1c0796..3e754d1 100644 --- a/www/index.js +++ b/www/index.js @@ -235,18 +235,18 @@ function updateImages(dllink, model, target, release, commit, prefix, images) { } } + function extractTags(image) { + var all = image.split('.')[0].split('-'); + var ignore = ['', 'kernel', 'zImage', 'uImage', 'factory', 'sysupgrade', 'rootfs', 'sdcard']; + return all.filter(function (el) { return !ignore.includes(el); }); + } + for (var category in entries) { var images = entries[category]; for (var i in images) { var image = images[i]; - // extract tags - var tags = []; - if (images.length > 1) { - var tags = image.split('.')[0].split('-'); - var ignore = ['', 'kernel', 'zImage', 'uImage', 'factory', 'sysupgrade', 'rootfs', 'sdcard']; - tags = tags.filter(function (el) { return !ignore.includes(el); }); - console.log(tags); - } + var tags = (images.length > 1) ? extractTags(image) : []; + add_link(category, tags, image, 'factory-help'); } } -- 2.30.2