From 0c138410706f9711ecd11686722355e7888bfe55 Mon Sep 17 00:00:00 2001 From: przemyslawpluta Date: Wed, 26 Mar 2014 19:52:34 +0000 Subject: link fix --- lib/login.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/login.js b/lib/login.js index d1b2d8c..7223126 100644 --- a/lib/login.js +++ b/lib/login.js @@ -110,12 +110,16 @@ module.exports = { $('div.wiki-article p').children().filter('a').map(function map(i, item) { var current = $(item); - if (current.text().indexOf(options) !== -1) { list.push(current.attr('href')); } + if (current.text().indexOf(options) !== -1) { + list.push({ href: current.attr('href'), text: current.text() }); + } }); - getCourses = _.filter(list, function map(item) { return item.match(/(wiki\/M101|wiki\/M102|wiki\/C100|wiki\/M202)/); }); + getCourses = _.filter(list, function map(item) { + if (item.href.match(/(wiki\/M101|wiki\/M102|wiki\/C100|wiki\/M202|wiki\/list-youtube-links)/)) { return item; } + }); - callback(null, _.map(getCourses, function map(item) { return { name: item.replace(tag, '').slice(0, -1).slice(1).replace(/-/g, ' ').replace(/\//g, ': '), value: item }; })); + callback(null, _.map(getCourses, function map(item) { return { name: !item.href.match(/wiki\/list-youtube-links/) ? item.href.replace(tag, '').slice(0, -1).slice(1).replace(/-/g, ' ').replace(/\//g, ': ') : item.text, value: item.href }; })); } }); -- cgit v1.2.3