iegrip 0.0.8 → 0.0.9

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/iegrip/version.rb +1 -1
  3. data/lib/iegrip.rb +64 -9
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dad32bc2791aa090957ea0d0c02bc83fb2302b37
4
- data.tar.gz: 4d09269287ca0fe1b29451a6cbafd904c67cac16
3
+ metadata.gz: e91fd4dcf3f4cf53da481257929fb1321eee53cc
4
+ data.tar.gz: 8803be8bcd4a6851797b656044847c17c4ca6176
5
5
  SHA512:
6
- metadata.gz: f1c3f4648ee93d2d2cb7af0b4df9f064d78af402ec4dc4eee42ab354a265068e4cd58904c118e01a873c8a9eeb2d35f0f8350ed856196cb3441ac70980fc51b7
7
- data.tar.gz: 644a401a1ee9a5c2494257e05238b69babe24abf562a1df5c41bffbd560d8f280218cbdcef4dfb5da2703019a2ff8ec43ca878825403d8c1c5050d1d2f1f3353
6
+ metadata.gz: 1fb8fe242cb7830c5b3cb59d6d5ade187152bebcf51a9c0e2a4e92430275bb836fb575a67321e6d6717fb3019bb1a534f133430347415236d1dac56de4fc9f9f
7
+ data.tar.gz: 359e4dcd2c17b93afa419da88ed3189c1ebb9eb712526c3de6379eeca95121d3e5e1a40f7dc674be5433bdf8323b5ee4e942b94de20ee2b410f7f4457026c223
@@ -1,3 +1,3 @@
1
1
  module IEgrip
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/lib/iegrip.rb CHANGED
@@ -21,6 +21,9 @@ module IEgrip
21
21
  ver = fs.GetFileVersion(@raw_object.FullName)
22
22
  @majorVersion = ver.split(/\./)[0].to_i
23
23
  @urlDownloadToFile = Win32API.new('urlmon', 'URLDownloadToFileA', %w(l p p l l), 'l')
24
+ @event = WIN32OLE_EVENT.new(@raw_object,"DWebBrowserEvents2")
25
+ @downloading = nil
26
+ setup_event()
24
27
  end
25
28
 
26
29
  def version
@@ -39,21 +42,69 @@ module IEgrip
39
42
 
40
43
  COMPLETE_STATE = 4
41
44
  def wait_stable()
42
- stable_counter = 0
43
45
  loop do
44
- break if stable_counter >= 3
45
- if (@raw_object.Busy != true) and (@raw_object.ReadyState == COMPLETE_STATE)
46
- stable_counter += 1
47
- else
48
- sleep 0.5
49
- stable_counter = 0
50
- end
46
+ break if (@raw_object.Busy != true) and (@raw_object.ReadyState == COMPLETE_STATE)
47
+ WIN32OLE_EVENT.message_loop
48
+ end
49
+ loop do
50
+ break unless @downloading
51
+ WIN32OLE_EVENT.message_loop
51
52
  end
52
53
  end
53
54
 
54
55
  def export(href, filename)
55
56
  @urlDownloadToFile.call(0, href, filename, 0, 0)
56
57
  end
58
+
59
+ private
60
+
61
+ def setup_event()
62
+ @event.on_event("BeforeNavigate2") {
63
+ #puts " BeforeNavigate2"
64
+ @downloading = true
65
+ }
66
+ #@event.on_event("CommandStateChange") {
67
+ # puts " CommandStateChange"
68
+ #}
69
+ @event.on_event("DocumentComplete") {|param|
70
+ # a document is completely loaded and initialized.
71
+ if param.LocationURL == @raw_object.LocationURL
72
+ #puts " DocumentComplete. LocationURL match! : #{param.LocationURL}"
73
+ @downloading = false
74
+ else
75
+ #puts " DocumentComplete. "
76
+ end
77
+ }
78
+ #@event.on_event("DownloadBegin") {
79
+ # # a navigation operation begins.
80
+ # puts " DownloadBegin. "
81
+ #}
82
+ #@event.on_event("DownloadComplete") {
83
+ # # a navigation operation finishes, is halted, or fails.
84
+ # puts " Download Complete."
85
+ #}
86
+ #@event.on_event("NavigateComplete2") {
87
+ # # a navigation to a link is completed on a window element or a frameSet element.
88
+ # puts " NavigateComplete2."
89
+ #}
90
+ #@event.on_event("NewProcess") {
91
+ # puts " NewProcess"
92
+ #}
93
+ #@event.on_event("ProgressChange") {
94
+ # puts " ProgressChange"
95
+ #}
96
+ #@event.on_event("PropertyChange") {
97
+ # puts " PropertyChange"
98
+ #}
99
+ #@event.on_event("StatusTextChange") {
100
+ # puts " StatusTextChange"
101
+ #}
102
+ #@event.on_event("UpdatePageStatus") {
103
+ # puts " UpdatePageStatus"
104
+ #}
105
+
106
+
107
+ end
57
108
  end
58
109
 
59
110
  module ElementParent
@@ -171,7 +222,11 @@ module IEgrip
171
222
  when "img"
172
223
  inner.push "src='#{tag.src}'"
173
224
  when "input"
174
- inner.push "type='#{tag.Type}'"
225
+ attr_list = []
226
+ attr_list.push("type='#{tag.Type}'")
227
+ attr_list.push("name='#{tag.Name}'") if tag.Name != ""
228
+ attr_list.push("value='#{tag.value}'") if tag.value != ""
229
+ inner.push attr_list.join(" ")
175
230
  when "form"
176
231
  inner.push "action='#{tag.action}' method='#{tag.Method}'"
177
232
  when "option"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iegrip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - yac4423
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-19 00:00:00.000000000 Z
11
+ date: 2014-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler