bwkfanboy 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/doc/NEWS.rdoc +4 -0
- data/lib/bwkfanboy/plugins/quora.js +11 -11
- data/lib/bwkfanboy/plugins/quora.rb +2 -4
- data/lib/bwkfanboy/utils.rb +1 -1
- data/test/semis/quora.html +7 -20
- data/test/test_server.rb +1 -1
- metadata +59 -87
data/doc/NEWS.rdoc
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
A companion to 'quora.rb' plugin.
|
5
5
|
*/
|
6
6
|
|
7
|
-
var
|
7
|
+
var u = require('util')
|
8
8
|
|
9
9
|
function get_timestamps(data) {
|
10
10
|
var e = {}
|
@@ -14,7 +14,7 @@ function get_timestamps(data) {
|
|
14
14
|
|
15
15
|
if (f == 'FeedStoryItem') {
|
16
16
|
link = data[i][3]['q_path']
|
17
|
-
//
|
17
|
+
// u.puts(link)
|
18
18
|
}
|
19
19
|
|
20
20
|
if (f == 'DateTimeComponent') {
|
@@ -25,13 +25,13 @@ function get_timestamps(data) {
|
|
25
25
|
}
|
26
26
|
|
27
27
|
function collect_stdin(callback) {
|
28
|
-
var stdin = process.openStdin();
|
29
28
|
var input = '';
|
30
|
-
|
31
|
-
|
29
|
+
process.stdin.resume();
|
30
|
+
process.stdin.setEncoding('ascii');
|
31
|
+
process.stdin.on('data', function (chunk) {
|
32
32
|
input += chunk
|
33
33
|
});
|
34
|
-
stdin.on('end', function () {
|
34
|
+
process.stdin.on('end', function () {
|
35
35
|
callback(input);
|
36
36
|
});
|
37
37
|
};
|
@@ -90,6 +90,7 @@ function prepare4eval(body) {
|
|
90
90
|
"function AddQuestionLink(args) { return arr(arguments) }\n" +
|
91
91
|
"function QTextImageEnlarger(args) { return arr(arguments) }\n" +
|
92
92
|
"function NavigatorResults(args) { return arr(arguments) }\n" +
|
93
|
+
"function RateAnswerApproveButton(args) { return arr(arguments) }\n" +
|
93
94
|
'';
|
94
95
|
var tail = "\n_components;\n";
|
95
96
|
|
@@ -97,11 +98,10 @@ function prepare4eval(body) {
|
|
97
98
|
}
|
98
99
|
|
99
100
|
collect_stdin(function(t) {
|
100
|
-
//
|
101
|
+
// u.puts(t)
|
101
102
|
|
102
103
|
var script = process.binding('evals').Script
|
103
|
-
var code
|
104
|
-
|
105
|
-
|
106
|
-
sys.puts(JSON.stringify(get_timestamps(code), null, ' '))
|
104
|
+
var code = script.runInThisContext(prepare4eval(t))
|
105
|
+
// u.puts(u.inspect(code, false, null))
|
106
|
+
u.puts(JSON.stringify(get_timestamps(code), null, ' '))
|
107
107
|
})
|
@@ -3,8 +3,6 @@
|
|
3
3
|
# evaluate it in nodejs and construct a hash with 'article-name =>
|
4
4
|
# timestamp' pairs.
|
5
5
|
#
|
6
|
-
# Tested with nodejs 0.2.3.
|
7
|
-
#
|
8
6
|
# Requires:
|
9
7
|
#
|
10
8
|
# - 'quora.js' script in directory with the plugin;
|
@@ -17,9 +15,9 @@ class Page < Bwkfanboy::Parse
|
|
17
15
|
URI = 'http://www.quora.com/#{opt[0]}/answers'
|
18
16
|
URI_DEBUG = '/home/alex/lib/software/alex/bwkfanboy/test/semis/quora.html'
|
19
17
|
ENC = 'UTF-8'
|
20
|
-
VERSION =
|
18
|
+
VERSION = 10
|
21
19
|
COPYRIGHT = "See bwkfanboy's LICENSE file"
|
22
|
-
TITLE = "Last n answers (per-user) from Quora; requires nodejs"
|
20
|
+
TITLE = "Last n answers (per-user) from Quora; requires nodejs 0.3.7+"
|
23
21
|
CONTENT_TYPE = 'html'
|
24
22
|
end
|
25
23
|
|
data/lib/bwkfanboy/utils.rb
CHANGED
@@ -7,7 +7,7 @@ require 'active_support/core_ext/module/attribute_accessors'
|
|
7
7
|
module Bwkfanboy
|
8
8
|
module Meta
|
9
9
|
NAME = 'bwkfanboy'
|
10
|
-
VERSION = '1.2.
|
10
|
+
VERSION = '1.2.8'
|
11
11
|
USER_AGENT = "#{NAME}/#{VERSION} (#{RUBY_PLATFORM}; N; #{Encoding.default_external.name}; #{RUBY_ENGINE}; rv:#{RUBY_VERSION}.#{RUBY_PATCHLEVEL})"
|
12
12
|
PLUGIN_CLASS = 'Page'
|
13
13
|
DIR_TMP = "/tmp/#{Meta::NAME}/#{ENV['USER']}"
|