diff options
author | przemyslawpluta <przemekpluta@hotmail.com> | 2014-03-26 19:52:34 +0000 |
---|---|---|
committer | przemyslawpluta <przemekpluta@hotmail.com> | 2014-03-26 19:52:34 +0000 |
commit | 0c138410706f9711ecd11686722355e7888bfe55 (patch) | |
tree | 66e493412e26d89f40f0b75b46b0924e072690e4 | |
parent | 40167aa8b4c66497d07a450bc32856cd6afb0f63 (diff) | |
download | mongo-edu-0c138410706f9711ecd11686722355e7888bfe55.zip |
link fix
-rw-r--r-- | lib/login.js | 10 |
1 files 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 }; })); } }); |