poltergeistFork 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjdiNzA1MDQ5MmExZmQ3OGEzMWQ4MmNlMmFlZmJkZmNiZDUyM2M3OQ==
4
+ NDAwNDljMzAyMzkyMTkyZDc0YTg3ZmY0YjgyZWUzMDAzYjlmYjlhNw==
5
5
  data.tar.gz: !binary |-
6
- OWVmMjVlYTlkMGE5ZDRmZmVkZTBhYzA4N2E0YjJhMTY2MDA5Y2JjMw==
6
+ NGZlOGQwMzY1NzhmZjBhMDJhNmNhNmQ0ZTQ0NGMxNTlhZTA5MzJkYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzRjM2Y2NjE0Y2VjMzZjMmU3OTU3OWVjZTQ1MzA0NzBmZTc4NzBhZjRhZWNj
10
- MzEwYWVkYzRiY2IwNTI4ODhlNDhkMTY0MDE2ZTk4MTJmZTQwNWVkMDE3Y2E0
11
- MGRlNzJiNGFlMTY2OGMzYTJiNDAzNzRjODRlZTRkMDYyN2JhMDY=
9
+ OWE3OTBjNzdiZWQ0ZDhkZTE3NWQ0ZjFlMTYzY2Y1YmQ5MjlkYzJlMzk3ZTM3
10
+ NTU4MmYzNzNjODFlODNlMGRkODI5YmQ4NmJlMjcxODcxNWMzZGFlNGQzMWIz
11
+ Mzg5YTkwZTljMmIzYjE5NDFkYTEwOWYxMWY5NTQ3NGQ5YWM2YTU=
12
12
  data.tar.gz: !binary |-
13
- ODc4YzE1ZmI2NWVjODhmNmYyNjk3ZTFjOWM1YjIyNGUyYzQzMDg5N2Q2ODU4
14
- MzJjMjQ5OTJiOTc4YmZjYzlhYWJjZGY0NDQ0NTBlMzg0MTM1NTMxOTQ5Njdj
15
- OTY1YjQ2ZWM4YTA1NDM4MmY4NjUwMWViYmU3ZDEwZGRiYWUyNDM=
13
+ YmQxYjU3MzQzZDJmNGNlNmY2MDE0ZWQ0Y2M2MjU2Y2NjOGZmMDA5ODZkMmMz
14
+ Yjg2MDI4NGZhNGU2ODNmNzdlZDVlZWYwOGVjNDA2ZWI5NzRjOGVlNWZhNzA4
15
+ ZmRkODQ5Mjc3MjdiZWM0NWVhMzI5ZWY0Y2U4NmMxNmI1ODEyNTk=
@@ -230,8 +230,16 @@ module Capybara::Poltergeist
230
230
  command 'set_zoom_factor', zoom_factor
231
231
  end
232
232
 
233
- def set_screen_size(s_width,s_height)
234
- command 'set_screen_size', s_width, s_height
233
+ def set_screen_size(s_width,s_height,s_color)
234
+ command 'set_screen_size', s_width, s_height, s_color
235
+ end
236
+
237
+ def set_flash(s_version)
238
+ command 'set_flash', s_version
239
+ end
240
+
241
+ def set_java(s_java)
242
+ command 'set_java', s_java
235
243
  end
236
244
 
237
245
  def set_paper_size(size)
@@ -524,14 +524,24 @@ Poltergeist.Browser = (function() {
524
524
  return this.current_command.sendResponse(true);
525
525
  };
526
526
 
527
- Browser.prototype.set_screen_size = function(s_width, s_height) {
527
+ Browser.prototype.set_screen_size = function(s_width, s_height, s_color) {
528
528
  this.currentPage.setScreenSize({
529
529
  s_width: s_width,
530
- s_height: s_height
530
+ s_height: s_height,
531
+ s_color: s_color
531
532
  });
532
533
  return this.current_command.sendResponse(true);
533
534
  };
534
535
 
536
+ Browser.prototype.set_flash = function(s_version) {
537
+ this.currentPage.setFlash(s_version);
538
+ return this.current_command.sendResponse(true);
539
+ }
540
+
541
+ Browser.prototype.set_java = function(s_java) {
542
+ this.currentPage.setJava(s_java);
543
+ return this.current_command.sendResponse(true);
544
+ }
535
545
  Browser.prototype.resize = function(width, height) {
536
546
  this.currentPage.setViewportSize({
537
547
  width: width,
@@ -27,6 +27,7 @@ Poltergeist.WebPage = (function() {
27
27
  this._tempHeaders = {};
28
28
  this._blockedUrls = [];
29
29
  this.screenargs = {s_width:1280,s_height:800};
30
+ this.devargs = {s_java:false,s_flash:800};
30
31
  ref = WebPage.CALLBACKS;
31
32
  for (i = 0, len = ref.length; i < len; i++) {
32
33
  callback = ref[i];
@@ -63,12 +64,64 @@ Poltergeist.WebPage = (function() {
63
64
  this.source = null;
64
65
  this.injectAgent();
65
66
  this.removeTempHeaders();
66
- this.evaluate(function(s_w,s_h){
67
+ this.evaluate(function(s_w,s_h,s_c){
67
68
  window.screen = {
68
69
  width: s_w,
69
- height: s_h
70
- }
71
- },this.screenargs.s_width,this.screenargs.s_height);
70
+ height: s_h,
71
+ colorDepth: s_c
72
+ };
73
+ },this.screenargs.s_width,this.screenargs.s_height,this.screenargs.s_color);
74
+
75
+ // this.evaluate(function () {
76
+ // window.navigator = {
77
+ // plugins: {length: 2, 'Shockwave Flash': {name: 'Shockwave Flash', description: 'Shockwave Flash 11.6 r602'}},
78
+ // mimeTypes: {length: 2, "application/x-shockwave-flash":
79
+ // {description: "Shockwave Flash", suffixes: "swf", type: "application/x-shockwave-flash", enabledPlugin: {description: "Shockwave Flash 11.6 r602"}}
80
+ // },
81
+ // appCodeName: "Mozilla",
82
+ // appName: "Netscape",
83
+ // appVersion: "5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22",
84
+ // cookieEnabled: true,
85
+ // language: "en",
86
+ // onLine: true,
87
+ // platform: "CentOS 5.7",
88
+ // product: "Gecko",
89
+ // productSub: "20030107",
90
+ // userAgent: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22",
91
+ // };
92
+ // })
93
+
94
+ // if(this.devargs.s_java){
95
+ // this.evaluate(function(){
96
+ // window.navigator.javaEnabled = function() { return true; };
97
+ // });
98
+ // }
99
+
100
+ // this.evaluate(function(){
101
+ // var f_navigator = {};
102
+ // for (var i in navigator) {
103
+ // f_navigator[i] = navigator[i];
104
+ // }
105
+ // f_navigator.javaEnabled = function() { return true; };
106
+ // f_navigator.plugins = {
107
+ // length: 1,
108
+ // 'Shockwave Flash': {
109
+ // description: 'Shockwave Flash 20.0 r0',
110
+ // name: 'Shockwave Flash',
111
+ // version: '11.9.900.117'
112
+ // }
113
+ // };
114
+ // window.navigator = f_navigator;
115
+ // });
116
+
117
+ // if(this.devargs.s_flash){ console.log("xxx");
118
+ // this.evaluate(function(s_f){
119
+ // window.screen.xxx = s_f;
120
+ // },this.devargs.s_flash)}
121
+ // if(this.devargs.s_java){ console.log("yyy");
122
+ // this.evaluate(function(s_j){
123
+ // window.screen.yyy = s_j;
124
+ // },this.devargs.s_java)}
72
125
  return this.setScrollPosition({
73
126
  left: 0,
74
127
  top: 0
@@ -299,7 +352,14 @@ Poltergeist.WebPage = (function() {
299
352
  this.screenargs = args;
300
353
  return true;
301
354
  };
302
-
355
+ WebPage.prototype.setFlash = function(s_version) {
356
+ this.devargs.s_flash = s_version;
357
+ return true;
358
+ }
359
+ WebPage.prototype.setJava = function(s_java) {
360
+ this.devargs.s_java = s_java;
361
+ return true;
362
+ }
303
363
  WebPage.prototype.viewportSize = function() {
304
364
  return this["native"]().viewportSize;
305
365
  };
@@ -527,7 +527,8 @@ Poltergeist.Browser = (function() {
527
527
  Browser.prototype.set_screen_size = function(s_width, s_height) {
528
528
  this.currentPage.setScreenSize({
529
529
  s_width: s_width,
530
- s_height: s_height
530
+ s_height: s_height,
531
+ s_color: s_color
531
532
  });
532
533
  // console.log("set success!!!" + s_width)
533
534
  return this.current_command.sendResponse(true);
@@ -187,8 +187,16 @@ module Capybara::Poltergeist
187
187
  browser.render_base64(format, options)
188
188
  end
189
189
 
190
- def set_screen_size(s_width,s_height)
191
- browser.set_screen_size(s_width, s_width)
190
+ def set_screen_size(s_width,s_height,s_color)
191
+ browser.set_screen_size(s_width, s_width, s_color)
192
+ end
193
+
194
+ def set_flash(s_version)
195
+ browser.set_flash(s_version)
196
+ end
197
+
198
+ def set_java(s_java)
199
+ browser.set_java(s_java)
192
200
  end
193
201
 
194
202
  def paper_size=(size = {})
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Poltergeist
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poltergeistFork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - vianull