This repository was archived by the owner on Jun 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +25
-18
lines changed Expand file tree Collapse file tree 1 file changed +25
-18
lines changed Original file line number Diff line number Diff line change 2
2
# Returns title and description when links are posted
3
3
#
4
4
# Dependencies:
5
- # "jsdom": "0.2.15 "
5
+ # "jsdom": "0.8.10 "
6
6
# "underscore": "1.3.3"
7
7
#
8
8
# Configuration:
@@ -40,21 +40,28 @@ module.exports = (robot) ->
40
40
if ! ignore && ignorePattern
41
41
ignore = url .match (ignorePattern)
42
42
43
+ jquery = ' http://code.jquery.com/jquery-1.9.1.min.js'
44
+
45
+ done = (errors , window ) ->
46
+ unless errors
47
+ $ = window .$
48
+ title = $ (' title' ).text ()
49
+ description = $ (' meta[name=description]' ).attr (" content" ) || " "
50
+
51
+ if title and description and not process .env .HUBOT_HTTP_INFO_IGNORE_DESC
52
+ msg .send " #{ title} \n #{ description} "
53
+
54
+ else if title
55
+ msg .send " #{ title} "
56
+
43
57
unless ignore
44
- jsdom .env (
45
- html : url
46
- scripts : [
47
- ' http://code.jquery.com/jquery-1.9.1.min.js'
48
- ]
49
- done : (errors , window ) ->
50
- unless errors
51
- $ = window .$
52
- title = $ (' title' ).text ()
53
- description = $ (' meta[name=description]' ).attr (" content" ) || " "
54
-
55
- if title and description and not process .env .HUBOT_HTTP_INFO_IGNORE_DESC
56
- msg .send " #{ title} \n #{ description} "
57
-
58
- else if title
59
- msg .send " #{ title} "
60
- )
58
+ if jsdom .version < ' 0.7.0'
59
+ jsdom .env
60
+ html : url
61
+ scripts : [ jquery ]
62
+ done : done
63
+ else
64
+ jsdom .env
65
+ url : url
66
+ scripts : [ jquery ]
67
+ done : done
You can’t perform that action at this time.
0 commit comments