shutterbug 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Yjg4MjkzMTJhYzExYTVjMWRlMjA3NjJlMzZkOGQwNTRlNGQ1OWVkYg==
4
+ YWM3Y2Q1MDlmMzI3MjVkYjkzNTYzYzEyMTUwNzdhNmFjZWVhMzM1OQ==
5
5
  data.tar.gz: !binary |-
6
- NDYwOGE0ZTM2ZDllOTU4MDVlMTg5N2Y5MzhiMWRiODU3ZDZlZDQ1Ng==
6
+ NTZhNGExZTc0OTNhOTFjMzE3MGE0N2NlMTQ1ZjQyZTVhNmRlYzkwNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTcwODhkNGNlZmVhNmY4N2ZkY2RhZWYzYzg1M2EzNWQxOTQyYjIzZjI2ZmEy
10
- N2YzMzkwNDk5ZmJlY2MxZmNiNmQ5MDJmZTI0MjgwZDRjYTk4NjU1MWFlNzM2
11
- ZjIyYjdiMDUwZjU2NDMxNDBjOWM0Y2NjOGQ1ZjJlOTNjYjQxMDU=
9
+ ODM2Nzc3MGVmZmQwOTVkZWZmNzg4NTllNjMzY2JiNjlhZTg5MzNhODNkNGJh
10
+ NTg2NmU4MGM3OGUwZDIyMTc3ZjQ5OWUxZGJlNmQ0ZjY0ZDBjYTRhOTEwZTZl
11
+ NGFjYzM2Y2M4N2IzODBmZTIzZjA4Y2Y4ZDg4YzNjMzk0YTY0Y2Q=
12
12
  data.tar.gz: !binary |-
13
- NzA5YWViZWZjOTJhZTQ0YjE5NjM3NjczMjdlM2VlOWM1OTZkYWM3Y2U3Y2Ni
14
- MTg4ZjE4ZDY2Y2UwMjg2YjU4Y2VmZjExNDE3NDRlMTAzZWEyYmI0N2JhZGNi
15
- YmExY2MyNzQ5NTFlMTk3MjAzMzI2MGI0NzAzNzA3MjYwZTVjNzg=
13
+ NWVhNDM2YzlkOWExNzJiMjIwNDgxZGZhZjZmYWY2ZTNkZWU4Y2U5NjE4M2Fh
14
+ NDliYTI4MDc3ZTdiMzUxNDY5MTZjMTViYzc4OWVmZTU3ZmIxYjZlMWFkOWM2
15
+ OTgyYmFmZmVkODA4NTcwMGM3MTg1ZjI1MzE0ZGQzY2RmNTIzNGY=
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-1.9.3-p392
1
+ ruby-1.9.3
data/LICENSE.md CHANGED
@@ -1,9 +1,5 @@
1
1
  ## [shutterbug](https://github.com/concord-consortium/shutterbug) ##
2
- is Copyright 2012 © by the Concord Consortium and is distributed under any of the following licenses:
3
-
4
- * [Simplified BSD](http://www.opensource.org/licenses/BSD-2-Clause),
5
- * [MIT](http://www.opensource.org/licenses/MIT), or
6
- * [Apache 2.0](http://www.opensource.org/licenses/Apache-2.0).
2
+ is Copyright 2012 © by the Concord Consortium and is distributed under the [MIT License](http://www.opensource.org/licenses/MIT).
7
3
 
8
4
  ##MIT License##
9
5
 
@@ -27,101 +23,3 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27
23
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
24
 
29
25
  In the original BSD license, both occurrences of the phrase "COPYRIGHT HOLDERS AND CONTRIBUTORS" in the disclaimer read "REGENTS AND CONTRIBUTORS".
30
-
31
- ----
32
-
33
- ## Simplified BSD License ##
34
-
35
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
36
-
37
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
38
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
39
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
-
41
- ----
42
-
43
- ## Apache License ##
44
-
45
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
46
-
47
- 1. Definitions.
48
-
49
- "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
50
-
51
- "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
52
-
53
- "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
54
-
55
- "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
56
-
57
- "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
58
-
59
- "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
60
-
61
- "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
62
-
63
- "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
64
-
65
- "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
66
-
67
- "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
68
-
69
- 2. Grant of Copyright License.
70
-
71
- Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License.
74
-
75
- Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
76
-
77
- 4. Redistribution.
78
-
79
- You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
80
-
81
- You must give any other recipients of the Work or Derivative Works a copy of this License; and
82
- You must cause any modified files to carry prominent notices stating that You changed the files; and
83
- You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
84
- If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
85
- You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
86
-
87
- 5. Submission of Contributions.
88
-
89
- Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
90
-
91
- 6. Trademarks.
92
-
93
- This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
94
-
95
- 7. Disclaimer of Warranty.
96
-
97
- Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
98
-
99
- 8. Limitation of Liability.
100
-
101
- In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
102
-
103
- 9. Accepting Warranty or Additional Liability.
104
-
105
- While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
106
-
107
- END OF TERMS AND CONDITIONS
108
-
109
- APPENDIX: How to apply the Apache License to your work
110
-
111
- To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
112
-
113
- Copyright [yyyy] [name of copyright owner]
114
-
115
- Licensed under the Apache License, Version 2.0 (the "License");
116
- you may not use this file except in compliance with the License.
117
- You may obtain a copy of the License at
118
-
119
- http://www.apache.org/licenses/LICENSE-2.0
120
-
121
- Unless required by applicable law or agreed to in writing, software
122
- distributed under the License is distributed on an "AS IS" BASIS,
123
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124
- See the License for the specific language governing permissions and
125
- limitations under the License.
126
-
127
-
data/README.md CHANGED
@@ -47,11 +47,8 @@ Or install it yourself as:
47
47
 
48
48
  ## License ##
49
49
 
50
- * [Simplified BSD](http://www.opensource.org/licenses/BSD-2-Clause),
51
- * [MIT](http://www.opensource.org/licenses/MIT), or
52
- * [Apache 2.0](http://www.opensource.org/licenses/Apache-2.0).
50
+ Shutterbug is Copyright 2012 © by the Concord Consortium and is distributed under the [MIT License](LICENSE.md).
53
51
 
54
- See [LICENSE.md](LICENSE.md) for more information.
55
52
 
56
53
  ### Deploying on Heroku ###
57
54
 
@@ -94,6 +91,13 @@ And a Procfile which looks like this:
94
91
 
95
92
  ## Changes ##
96
93
 
94
+ * May 28, 2015 – v 0.5.2
95
+ * Rasterize.js: "Loads an html page and does a depth-first walk of its
96
+ iframes. As the walk returns to the root each iframe's src is set to the
97
+ base64 png rendering of its contents." The purpose of this change was to
98
+ allow SVG document relative resource links (such as gradients) to work,
99
+ this required the removal of the base tag to work in Phantom 2.
100
+
97
101
  * December 11, 2014 – v 0.5.0
98
102
  * JS lib, JS handler and demos removed (as they are part of the new [shutterbug.js](https://github.com/concord-consortium/shutterbug.js) repo now).
99
103
 
@@ -1,31 +1,217 @@
1
- /*global phantom */
1
+ /*
2
+ Loads an html page and does a depth-first walk of its iframes. As the walk returns to the root each iframe's
3
+ src is set to the base64 png rendering of its contents. At the root the updated page content is rendered to an image.
4
+
5
+ This code uses two recursive methods: drainIFrameQueue() in processIframes() and loadPage(). drainIFrameQueue() is simply an async
6
+ for loop over the iframes found in processIframes(). loadPage() recurses in a somewhat oblique manner via processIFrames().
7
+
8
+ Here is a sample flattened call trace for a invocation on a page containing 1 iframe which itself contains no iframes:
9
+
10
+ // main entry point
11
+ renderPage()
12
+
13
+ // load page html
14
+ loadPage(pageHtml, cb1)
15
+ createPage(pageHtml, pageBase, cb2)
16
+ cb2(page)
17
+
18
+ // process page iframes
19
+ processIFrames(page, cb3)
20
+ getIFrameSrc()
21
+ drainIFrameQueue() <- outer page queue
2
22
 
3
- var page = require('webpage').create(),
4
- system = require('system'),
5
- address, output, quality, size;
23
+ // load page iframe html
24
+ loadPage(iframeHTML, cb4) <- 1 iframe found in page html so that iframe is loaded as a page
25
+ createPage(iframeHTML, iframeBase, cb5)
26
+ cb5(iframePage)
27
+
28
+ // process page iframe inner iframes
29
+ processIFrames(iframePage, cb6)
30
+ getIFrameSrc()
31
+ drainIFrameQueue() <- inner frame queue
32
+ cb6(hasIframes=false) <- no iframes found in inner iframe html so callback called immediately
33
+ cb4(iframePage, iframeBase, hasIframes)
34
+
35
+ // replace page iframe src with rendered image
36
+ createPage(iframeHTML, iframeBase, cb7) <-- loaded in separate page so the updated iframe src is rendered correctly
37
+ cb7(finalIFrame)
38
+ updateIframeAndContinue(finalIFrame)
39
+ drainIFrameQueue() <- outer page queue
40
+ cb3(hasIframes=true)
41
+ cb1(page, base, hasIframes)
42
+
43
+ // render page
44
+ createPage(pageHtml, pageBase, cb8)
45
+ cb8(finalPage)
46
+ finalPage.render()
47
+ phantom.exit();
48
+ */
49
+
50
+ /*global phantom */
51
+ var system = require('system'),
52
+ fs = require('fs'),
53
+ baseRegEx = /<\s*base[^>]+href\s*=\s*['"]([^'"]*)['"][^>]*>/i,
54
+ viewportSize = { width: 1000, height: 700 },
55
+ filename, output, quality, size, base, html;
6
56
 
7
57
  if (system.args.length < 3 || system.args.length > 5) {
8
- console.log('Usage: rasterize.js URL filename quality(0-100)');
58
+ console.log('Usage: rasterize.js URL filename width*height quality(0-100)');
9
59
  phantom.exit(1);
10
- } else {
11
- address = system.args[1];
12
- output = system.args[2];
13
- page.viewportSize = { width: 1000, height: 700 };
14
- if (system.args.length > 3) {
15
- size = system.args[3].split('*');
16
- page.viewportSize = { width: size[0], height: size[1] };
17
- quality = system.args[4];
18
- }
60
+ }
61
+
62
+ // get the options
63
+ filename = system.args[1];
64
+ output = system.args[2];
65
+ if (system.args.length > 3) {
66
+ size = system.args[3].split('*');
67
+ viewportSize = { width: size[0], height: size[1] };
68
+ quality = system.args[4];
69
+ }
70
+
71
+ // let 'er rip!
72
+ renderPage();
73
+
74
+ // Main function, called once
75
+ function renderPage() {
76
+ // this is the initial load of the html provided by phantom_job.rb
77
+ loadPage(fs.read(filename), function (page, base, hasIframes) {
78
+ // At this point the page has been "walked", and if it includes iframes, loadPage() has been called on each iframe.
79
+ // The iframe srces have been updated to a data-uri that has an image taken of the iframe contents.
80
+ if (hasIframes) {
81
+ // phantom does not seem to want to render changed iframe content when the src parameter is modified
82
+ // so we need to reload it in another page
83
+ createPage(page.content, base, function (finalPage) {
84
+ finalPage.render(output, {quality: quality});
85
+ phantom.exit();
86
+ });
87
+ }
88
+ else {
89
+ page.render(output, {quality: quality});
90
+ phantom.exit();
91
+ }
92
+ });
93
+ }
94
+
95
+ // This function is called recursively via processIFrames() for each iframe in the page.
96
+ // The base tag is removed from the html and passed to createPage() which uses phantom's
97
+ // setContent() method to load the page. The base is removed because if it is present
98
+ // svg gradients are not rendered correctly as their fill ids are based on the base tag
99
+ // and not the local document.
100
+ function loadPage(html, callback) {
101
+ var m = html.match(baseRegEx),
102
+ base = m ? m[1] : '',
103
+ baselessHtml = html.replace(baseRegEx, '');
19
104
 
20
- page.open(address, function (status) {
105
+ createPage(baselessHtml, base, function (page) {
106
+ processIframes(page, function (hasIframes) {
107
+ callback(page, base, hasIframes);
108
+ });
109
+ });
110
+ }
111
+
112
+ // Creates the phantom page object using the passed in html and base and returns it in a callback
113
+ function createPage(html, base, callback) {
114
+ var page = require('webpage').create();
115
+
116
+ page.onLoadFinished = function(status) {
21
117
  if (status !== 'success') {
22
- console.log('Unable to load the address!');
118
+ console.log('Unable to load html!');
23
119
  phantom.exit();
24
- } else {
25
- window.setTimeout(function () {
26
- page.render(output, {quality: quality});
27
- phantom.exit();
28
- }, 200);
29
120
  }
30
- });
121
+
122
+ window.setTimeout(function () {
123
+ callback(page);
124
+ }, 200);
125
+ };
126
+
127
+ page.viewportSize = viewportSize;
128
+ page.setContent(html, base);
129
+ }
130
+
131
+ // Gets the source of each iframe and then loads that source in a separate page.
132
+ // The loaded iframe page is then rendered as a data-uri containing an img tag
133
+ // with its src being the base64 encoded png render of the iframe contents
134
+ function processIframes(page, callback) {
135
+
136
+ var iframeSrc = getIframeSrc(page),
137
+ iframePng = [],
138
+ queueIndex = 0;
139
+
140
+ // Since this is async we can't loop but instead recursivly call drainIFrameQueue()
141
+ // until all the iframes have been processed. Once they have all been processed
142
+ // the callback is invoked passing a flag if iframe were found in the page.
143
+ // The flag is used to see if we need to reload the final updated html in another
144
+ // page for rendering as phantomjs doesn't seem to reflow the document when the
145
+ // pages iframe src attribute is updated.
146
+ drainIFrameQueue();
147
+
148
+ function drainIFrameQueue() {
149
+ if (queueIndex < iframeSrc.length) {
150
+
151
+ // This is the recursion down the iframes. It restarts the entire process
152
+ // of loading so we can handle an infinite number of embedded iframes.
153
+ // The recursion stops when it completes a depth first search of all the iframes
154
+ // starting at the root document.
155
+
156
+ loadPage(iframeSrc[queueIndex], function (iFrame, base, hasIFrames) {
157
+ // convert the iframe contents to a png and then set the src to it
158
+ if (hasIFrames) {
159
+ // reload the iframe so the src is used
160
+ createPage(iFrame.content, base, function (finalIFrame) {
161
+ updateIframeAndContinue(finalIFrame);
162
+ });
163
+ }
164
+ else {
165
+ updateIframeAndContinue(iFrame);
166
+ }
167
+
168
+ // renders the iframe to an image, updates the iframe src and then
169
+ // calls drainIFrameQueue() to process the rest of the page's iframes in the queue
170
+ function updateIframeAndContinue(iFrame) {
171
+ page.evaluate(function (queueIndex, src) {
172
+ document.getElementsByTagName('iframe').item(queueIndex).src = src;
173
+ }, queueIndex, renderIframeToImage(iFrame));
174
+ queueIndex++;
175
+ drainIFrameQueue();
176
+ }
177
+ });
178
+ }
179
+ else {
180
+ callback(iframeSrc.length > 0);
181
+ }
182
+ }
183
+ }
184
+
185
+ // This is the data uri that is used as a replacement of the iframe src
186
+ function renderIframeToImage(iFrame) {
187
+ return 'data:text/html,<html><head><style>body {margin: 0; padding: 0;}</style><body><img src="data:image/png;base64,' + iFrame.renderBase64('PNG') + '"></body></html>';
188
+ }
189
+
190
+ // Walks all the iframes in the current page and pushes their src onto an array that is returned.
191
+ // Phantom.js only allows simple types to cross the evaluate() boundary so the array is marshalled
192
+ // as a JSON string.
193
+ function getIframeSrc(page) {
194
+ return JSON.parse(page.evaluate(function () {
195
+ var iframes = document.getElementsByTagName('iframe'),
196
+ src = [],
197
+ mimeType = "data:text/html,",
198
+ serializer = new XMLSerializer(),
199
+ iframe, i;
200
+ for (i = 0; i < iframes.length; i++) {
201
+ iframe = iframes.item(i);
202
+ if (iframe.src.substr(0, mimeType.length) == mimeType) {
203
+ src.push(iframe.src.substr(mimeType.length));
204
+ }
205
+ else {
206
+ try {
207
+ src.push(serializer.serializeToString(iframe.contentDocument));
208
+ }
209
+ catch (e) {
210
+ src.push('');
211
+ }
212
+ }
213
+ }
214
+ // only simple types can be returned...
215
+ return JSON.stringify(src);
216
+ }));
31
217
  }
data/lib/shutterbug.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Shutterbug
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  autoload :Rackapp, "shutterbug/rackapp"
4
4
  autoload :Configuration, "shutterbug/configuration"
5
5
  autoload :Storage, "shutterbug/storage"
data/shutterbug.gemspec CHANGED
@@ -6,8 +6,8 @@ require 'shutterbug'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "shutterbug"
8
8
  spec.version = Shutterbug::VERSION
9
- spec.authors = ["Noah Paessel", "Piotr Janik"]
10
- spec.email = ["knowuh@gmail.com","janikpiotrek@gmail.com"]
9
+ spec.authors = ["Noah Paessel", "Piotr Janik", "Doug Martin"]
10
+ spec.email = ["knowuh@gmail.com","janikpiotrek@gmail.com", "doug@zoopdoop.com"]
11
11
 
12
12
  spec.description = %q{
13
13
  A rack utility that will create and save images (pngs)
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shutterbug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Paessel
8
8
  - Piotr Janik
9
+ - Doug Martin
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-12-12 00:00:00.000000000 Z
13
+ date: 2015-05-28 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: bundler
@@ -144,6 +145,7 @@ description: ! "\n A rack utility that will create and save images (pngs)\n
144
145
  email:
145
146
  - knowuh@gmail.com
146
147
  - janikpiotrek@gmail.com
148
+ - doug@zoopdoop.com
147
149
  executables: []
148
150
  extensions: []
149
151
  extra_rdoc_files: []
@@ -206,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
208
  version: '0'
207
209
  requirements: []
208
210
  rubyforge_project:
209
- rubygems_version: 2.2.2
211
+ rubygems_version: 2.4.5
210
212
  signing_key:
211
213
  specification_version: 4
212
214
  summary: use Shutterbug::Rackapp