pageflow-chart 2.1.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +12 -8
- data/README.md +2 -2
- data/app/assets/javascripts/pageflow/chart/consent.js +16 -0
- data/app/assets/javascripts/pageflow/chart/editor/config.js +7 -0
- data/app/assets/javascripts/pageflow/chart/editor/models/scraped_site.js +11 -50
- data/app/assets/javascripts/pageflow/chart/editor/views/configuration_editor.js +6 -4
- data/app/assets/javascripts/pageflow/chart/editor/views/embedded/iframe_embedded_view.js +32 -16
- data/app/assets/javascripts/pageflow/chart/editor/views/inputs/scraped_url_input_view.js +18 -39
- data/app/assets/javascripts/pageflow/chart/editor.js +4 -3
- data/app/assets/javascripts/pageflow/chart/page_type.js +61 -53
- data/app/assets/javascripts/pageflow/chart.js +2 -3
- data/app/assets/stylesheets/pageflow/chart/editor.scss +3 -20
- data/app/assets/stylesheets/pageflow/chart/themes/default.scss +3 -0
- data/app/assets/stylesheets/pageflow/chart.scss +9 -16
- data/app/helpers/pageflow/chart/scraped_sites_helper.rb +17 -8
- data/app/jobs/pageflow/chart/scrape_site_job.rb +14 -4
- data/app/models/pageflow/chart/scraped_site.rb +37 -4
- data/app/views/pageflow/chart/editor/scraped_sites/_scraped_site.json.jbuilder +1 -0
- data/app/views/pageflow/chart/page.html.erb +9 -2
- data/chart.gemspec +2 -2
- data/config/locales/de.yml +4 -0
- data/config/locales/en.yml +4 -0
- data/db/migrate/20190531141820_add_file_attributes_to_scraped_sites.rb +8 -0
- data/db/migrate/20190531145431_insert_file_usages_for_scraped_sites.rb +59 -0
- data/db/migrate/20200507141608_add_javascript_body_attachment_to_scraped_site.rb +5 -0
- data/lib/pageflow/chart/configuration.rb +6 -3
- data/lib/pageflow/chart/downloader.rb +4 -1
- data/lib/pageflow/chart/page_type.rb +17 -0
- data/lib/pageflow/chart/plugin.rb +10 -0
- data/lib/pageflow/chart/refresh_tag_following_downloader.rb +3 -3
- data/lib/pageflow/chart/scraper.rb +25 -13
- data/lib/pageflow/chart/version.rb +1 -1
- data/lib/pageflow/chart.rb +4 -0
- data/spec/factories/scraped_sites.rb +17 -3
- data/spec/fixtures/all.css +3 -0
- data/spec/fixtures/all.js +1 -0
- data/spec/fixtures/all_body.js +1 -0
- data/spec/fixtures/data.csv +1 -0
- data/spec/fixtures/index.html +7 -0
- data/spec/helpers/pageflow/chart/scraped_sites_helper_spec.rb +59 -0
- data/spec/integration/file_type_spec.rb +10 -0
- data/spec/jobs/pageflow/chart/scrape_site_job_spec.rb +14 -1
- data/spec/models/pageflow/chart/scraped_site_spec.rb +54 -0
- data/spec/pageflow/chart/downloader_spec.rb +13 -3
- data/spec/pageflow/chart/refresh_tag_following_downloader_spec.rb +23 -10
- data/spec/pageflow/chart/scraper_spec.rb +201 -63
- metadata +28 -20
- data/app/assets/javascripts/pageflow/chart/editor/collections/scraped_sites_collection.js +0 -23
- data/app/assets/javascripts/pageflow/chart/editor/initializers/setup_collections.js +0 -1
- data/app/assets/javascripts/pageflow/chart/editor/templates/scraped_site_status.jst.ejs +0 -2
- data/app/assets/javascripts/pageflow/chart/editor/templates/url_input.jst.ejs +0 -7
- data/app/assets/javascripts/pageflow/chart/editor/views/scraped_site_status_view.js +0 -18
- data/app/controllers/pageflow/chart/application_controller.rb +0 -6
- data/app/controllers/pageflow/chart/scraped_sites_controller.rb +0 -25
- data/config/routes.rb +0 -3
- data/spec/controllers/pageflow/chart/scraped_sites_controller_spec.rb +0 -35
- data/spec/requests/scraping_site_spec.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eaf6b87c76738d2e7efa81a3732a96ef09820bc1b2ca74e9a6e79c71532862c
|
4
|
+
data.tar.gz: 8ad985582dbd2205427546becca4aaa6033394f6c5b6b91e6be69f248bf7f9e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f95634d293e9fe2c59600172e89e07ca177166ae1da0224bdbb96c8331a4406e68d7650fcc89c360f8ddbdeca5f81deaa66fe030a97470d7dd5f4c49f5baacb6
|
7
|
+
data.tar.gz: 5127f6494bd7819de6f6203b96f4cf5a6074db0953ee5d06fff2c5b0337f699bd5794fc0070267a9cfbb8c86c314e94707a235f81fc8e6fd9c199b6a2100f032
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
### Version 2.
|
3
|
+
### Version 2.4.0
|
4
4
|
|
5
|
-
|
5
|
+
2022-07-18
|
6
6
|
|
7
|
-
[Compare changes](https://github.com/codevise/pageflow-chart/compare/2-
|
7
|
+
[Compare changes](https://github.com/codevise/pageflow-chart/compare/2-3-stable...v2.4.0)
|
8
8
|
|
9
|
-
-
|
10
|
-
([#
|
11
|
-
-
|
12
|
-
([#
|
9
|
+
- Use rebrushed button style in editor
|
10
|
+
([#61](https://github.com/codevise/pageflow-chart/pull/61))
|
11
|
+
- Make chart urls protocol relative
|
12
|
+
([#60](https://github.com/codevise/pageflow-chart/pull/60))
|
13
|
+
- Display original chart instead of scraped site
|
14
|
+
([#59](https://github.com/codevise/pageflow-chart/pull/59))
|
15
|
+
- Embed opt-in
|
16
|
+
([#58](https://github.com/codevise/pageflow-chart/pull/58))
|
13
17
|
|
14
18
|
See
|
15
|
-
[2-
|
19
|
+
[2-3-stable branch](https://github.com/codevise/pageflow-chart/blob/2-3-stable/CHANGELOG.md)
|
16
20
|
for previous changes.
|
data/README.md
CHANGED
@@ -17,10 +17,10 @@ Mount the engine:
|
|
17
17
|
# config/routes.rb
|
18
18
|
mount Pageflow::Chart::Engine, at: '/chart'
|
19
19
|
|
20
|
-
Register the
|
20
|
+
Register the plugin:
|
21
21
|
|
22
22
|
# config/initializers/pageflow.rb
|
23
|
-
config.
|
23
|
+
config.plugin(Pageflow::Chart.plugin)
|
24
24
|
|
25
25
|
Include javascript/stylesheets:
|
26
26
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
pageflow.chart.consent = {
|
2
|
+
ensureVendorRegistered: function(options) {
|
3
|
+
if (this.registered) {
|
4
|
+
return;
|
5
|
+
}
|
6
|
+
|
7
|
+
this.registered = true;
|
8
|
+
options = options || {}
|
9
|
+
|
10
|
+
pageflow.consent.registerVendor('datawrapper', {
|
11
|
+
paradigm: options.skip ? 'skip' : 'lazy opt-in',
|
12
|
+
displayName: I18n.t('pageflow.public.chart.consent_vendor_name'),
|
13
|
+
description: I18n.t('pageflow.public.chart.consent_vendor_description')
|
14
|
+
});
|
15
|
+
}
|
16
|
+
};
|
@@ -1,55 +1,16 @@
|
|
1
|
-
pageflow.chart.ScrapedSite =
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
this.pollUntilScraped();
|
9
|
-
}
|
10
|
-
});
|
11
|
-
},
|
12
|
-
|
13
|
-
urlRoot: function() {
|
14
|
-
return '/chart/scraped_sites';
|
15
|
-
},
|
16
|
-
|
17
|
-
isProcessed: function() {
|
18
|
-
return this.get('state') === 'processed';
|
19
|
-
},
|
20
|
-
|
21
|
-
isProcessing: function() {
|
22
|
-
return this.get('state') === 'processing';
|
23
|
-
},
|
24
|
-
|
25
|
-
isFailed: function() {
|
26
|
-
return this.get('state') === 'processing_failed';
|
27
|
-
},
|
28
|
-
|
29
|
-
pollUntilScraped: function() {
|
30
|
-
var model = this;
|
31
|
-
|
32
|
-
if (model.isProcessed()) {
|
33
|
-
return;
|
1
|
+
pageflow.chart.ScrapedSite = pageflow.ReusableFile.extend({
|
2
|
+
stages: [
|
3
|
+
{
|
4
|
+
name: 'processing',
|
5
|
+
activeStates: ['processing'],
|
6
|
+
finishedStates: ['processed'],
|
7
|
+
failedStates: ['processing_failed']
|
34
8
|
}
|
9
|
+
],
|
35
10
|
|
36
|
-
|
11
|
+
readyState: 'processed',
|
37
12
|
|
38
|
-
|
39
|
-
|
40
|
-
clearInterval(model.pollingInterval);
|
41
|
-
model.pollingInterval = null;
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
function poll() {
|
46
|
-
model.fetch({
|
47
|
-
success: function() {
|
48
|
-
if (!model.isProcessing()) {
|
49
|
-
stopPolling();
|
50
|
-
}
|
51
|
-
}
|
52
|
-
});
|
53
|
-
}
|
13
|
+
toJSON: function() {
|
14
|
+
return _.pick(this.attributes, 'url');
|
54
15
|
}
|
55
16
|
});
|
@@ -7,11 +7,13 @@ pageflow.ConfigurationEditorView.register('chart', {
|
|
7
7
|
});
|
8
8
|
|
9
9
|
this.tab('files', function() {
|
10
|
-
this.input('
|
11
|
-
supportedHosts: supportedHosts,
|
10
|
+
this.input('chart_url', pageflow.UrlInputView, {
|
12
11
|
displayPropertyName: 'display_scraped_site_url',
|
13
|
-
|
12
|
+
supportedHosts: supportedHosts,
|
13
|
+
required: true,
|
14
|
+
permitHttps: true
|
14
15
|
});
|
16
|
+
|
15
17
|
this.view(pageflow.chart.DatawrapperAdView);
|
16
18
|
this.input('full_width', pageflow.CheckBoxInputView);
|
17
19
|
this.group('background');
|
@@ -25,4 +27,4 @@ pageflow.ConfigurationEditorView.register('chart', {
|
|
25
27
|
this.group('options');
|
26
28
|
});
|
27
29
|
}
|
28
|
-
});
|
30
|
+
});
|
@@ -4,41 +4,57 @@ pageflow.chart.IframeEmbeddedView = Backbone.Marionette.View.extend({
|
|
4
4
|
},
|
5
5
|
|
6
6
|
render: function() {
|
7
|
-
this.
|
7
|
+
if (this.model.has('chart_url')) {
|
8
|
+
this.updateChartUrl();
|
9
|
+
}
|
10
|
+
else if (this.model.has('scraped_site_id')) {
|
11
|
+
this.updateScrapedSite();
|
12
|
+
}
|
13
|
+
|
8
14
|
return this;
|
9
15
|
},
|
10
16
|
|
11
17
|
update: function() {
|
12
|
-
if (this.model.hasChanged(
|
18
|
+
if (this.model.hasChanged('chart_url')) {
|
19
|
+
this.updateChartUrl();
|
20
|
+
}
|
21
|
+
else if (this.model.hasChanged('scraped_site_id')) {
|
13
22
|
this.updateScrapedSite();
|
14
23
|
}
|
15
24
|
},
|
16
25
|
|
17
|
-
|
18
|
-
var
|
26
|
+
updateChartUrl: function() {
|
27
|
+
var url = this.model.get('chart_url');
|
19
28
|
|
29
|
+
if (url) {
|
30
|
+
url = url.replace(/^https?:/, '');
|
31
|
+
}
|
32
|
+
|
33
|
+
this.$el.attr('src', url);
|
34
|
+
this.$el.removeAttr('data-use-custom-theme');
|
35
|
+
this.$el.removeAttr('data-customize-layout');
|
36
|
+
},
|
37
|
+
|
38
|
+
updateScrapedSite: function() {
|
20
39
|
if (this.scrapedSite) {
|
21
40
|
this.stopListening(this.scrapedSite);
|
22
41
|
}
|
23
42
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
this.scrapedSite = pageflow.chart.scrapedSites.getOrFetch(scrapedSiteId, {
|
28
|
-
success: function(scrapedSite) {
|
29
|
-
view.updateAttributes(scrapedSite);
|
30
|
-
}
|
31
|
-
});
|
43
|
+
this.scrapedSite = this.model.getReference('scraped_site_id',
|
44
|
+
'pageflow_chart_scraped_sites');
|
45
|
+
this.updateAttributes();
|
32
46
|
|
47
|
+
if (this.scrapedSite) {
|
33
48
|
this.listenTo(this.scrapedSite, 'change', this.updateAttributes);
|
34
49
|
}
|
35
50
|
},
|
36
51
|
|
37
|
-
updateAttributes: function(
|
38
|
-
scrapedSite =
|
52
|
+
updateAttributes: function() {
|
53
|
+
var scrapedSite = this.scrapedSite;
|
39
54
|
|
40
|
-
if (scrapedSite && scrapedSite.
|
55
|
+
if (scrapedSite && scrapedSite.isReady()) {
|
41
56
|
this.$el.attr('src', scrapedSite.get('html_file_url'));
|
57
|
+
this.$el.attr('data-customize-layout', 'true');
|
42
58
|
|
43
59
|
if (scrapedSite.get('use_custom_theme')) {
|
44
60
|
this.$el.attr('data-use-custom-theme', 'true');
|
@@ -51,4 +67,4 @@ pageflow.chart.IframeEmbeddedView = Backbone.Marionette.View.extend({
|
|
51
67
|
this.$el.attr('src', '');
|
52
68
|
}
|
53
69
|
}
|
54
|
-
});
|
70
|
+
});
|
@@ -1,49 +1,28 @@
|
|
1
1
|
pageflow.chart.ScrapedUrlInputView = pageflow.UrlInputView.extend({
|
2
|
-
|
2
|
+
className: 'chart_scraped_site_url_input_view',
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
},
|
4
|
+
save: function() {
|
5
|
+
var url = this.ui.input.val();
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
if (url) {
|
8
|
+
var scrapedSite = pageflow
|
9
|
+
.entry
|
10
|
+
.getFileCollection('pageflow_chart_scraped_sites')
|
11
|
+
.findOrCreateBy({url: url});
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
if (scrapedSite.isRetryable()) {
|
14
|
+
scrapedSite.retry();
|
15
|
+
}
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
{
|
20
|
-
url: url
|
21
|
-
},
|
22
|
-
{
|
23
|
-
success: function(scrapedSite) {
|
24
|
-
deferred.resolve(scrapedSite.id);
|
25
|
-
}
|
26
|
-
}
|
17
|
+
this.model.setReference(
|
18
|
+
this.options.propertyName,
|
19
|
+
scrapedSite
|
27
20
|
);
|
28
|
-
}).promise();
|
29
|
-
},
|
30
|
-
|
31
|
-
updateScrapingStatus: function() {
|
32
|
-
var scrapedSite = this.getScrapedSite();
|
33
|
-
|
34
|
-
if (scrapedSite) {
|
35
|
-
this.statusContainer.show(new pageflow.chart.ScrapedSiteStatusView({
|
36
|
-
model: scrapedSite
|
37
|
-
}));
|
38
21
|
}
|
39
22
|
else {
|
40
|
-
this.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
getScrapedSite: function() {
|
45
|
-
if (this.model.has(this.options.propertyName)) {
|
46
|
-
return pageflow.chart.scrapedSites.getOrFetch(this.model.get(this.options.propertyName));
|
23
|
+
this.model.unsetReference(
|
24
|
+
this.options.propertyName
|
25
|
+
);
|
47
26
|
}
|
48
27
|
}
|
49
|
-
});
|
28
|
+
});
|
@@ -1,9 +1,10 @@
|
|
1
1
|
//= require_self
|
2
|
+
|
2
3
|
//= require_tree ./editor/models
|
3
|
-
//= require_tree ./editor/collections
|
4
4
|
//= require_tree ./editor/views/inputs
|
5
5
|
//= require_tree ./editor/templates
|
6
6
|
//= require_tree ./editor/views
|
7
|
-
//= require_tree ./editor/initializers
|
8
7
|
|
9
|
-
|
8
|
+
//= require ./editor/config
|
9
|
+
|
10
|
+
pageflow.chart = pageflow.chart || {};
|
@@ -1,8 +1,19 @@
|
|
1
|
-
pageflow.
|
1
|
+
pageflow.pageType.registerInitializer('chart', function() {
|
2
|
+
pageflow.chart.consent.ensureVendorRegistered({
|
3
|
+
skip: !pageflow.features.isEnabled('chart_embed_opt_in')
|
4
|
+
});
|
5
|
+
});
|
2
6
|
|
7
|
+
pageflow.react.registerPageTypeWithDefaultBackground('chart', _.extend({
|
3
8
|
prepareNextPageTimeout: 0,
|
4
9
|
|
5
10
|
enhance: function(pageElement, configuration) {
|
11
|
+
pageElement.thirdPartyEmbedConsent();
|
12
|
+
|
13
|
+
if (!pageflow.features.isEnabled('chart_embed_opt_in')) {
|
14
|
+
pageElement.find('.opt_out_wrapper').hide();
|
15
|
+
}
|
16
|
+
|
6
17
|
var scroller = pageElement.find('.scroller');
|
7
18
|
|
8
19
|
pageElement.find('.bigscreen_toggler').on('click', function() {
|
@@ -41,9 +52,11 @@ pageflow.react.registerPageTypeWithDefaultBackground('chart', _.extend({
|
|
41
52
|
var that = this;
|
42
53
|
var iframe = pageElement.find('iframe');
|
43
54
|
var scroller = pageElement.find('.scroller');
|
44
|
-
var iframeOverlay = pageElement.find('.iframe_overlay');
|
45
55
|
|
46
|
-
if(!
|
56
|
+
if (!iframe.data('customizeLayout')) {
|
57
|
+
pageElement.find('.iframeWrapper').addClass('active');
|
58
|
+
}
|
59
|
+
else if(!this.layoutCustomized) {
|
47
60
|
iframe.load(function() {
|
48
61
|
$(this).contents().find('.fs-btn').css('display','none');
|
49
62
|
$(this).contents().find('body').addClass($("[data-theme]").attr('data-theme'));
|
@@ -80,63 +93,21 @@ pageflow.react.registerPageTypeWithDefaultBackground('chart', _.extend({
|
|
80
93
|
head.append('<link rel="stylesheet" type="text/css" href="' + path + '">');
|
81
94
|
},
|
82
95
|
|
83
|
-
_initEventSimulation: function(element, iframe, wrapper) {
|
84
|
-
element.on('click', function(event) {
|
85
|
-
var contentElement = iframe.contents()[0];
|
86
|
-
|
87
|
-
element.css('display', 'none');
|
88
|
-
|
89
|
-
if (contentElement && event) {
|
90
|
-
var offset = iframe.offset();
|
91
|
-
var options = $.extend({}, event, {
|
92
|
-
screenX: event.screenX - offset.left,
|
93
|
-
screenY: event.screenY - offset.top,
|
94
|
-
clientX: event.clientX - offset.left,
|
95
|
-
clientY: event.clientY - offset.top,
|
96
|
-
});
|
97
|
-
|
98
|
-
var lastElement = $(contentElement.elementFromPoint(event.pageX - offset.left,
|
99
|
-
event.pageY - offset.top));
|
100
|
-
|
101
|
-
lastElement.simulate('mousedown', options);
|
102
|
-
lastElement.simulate('mousemove', options);
|
103
|
-
lastElement.simulate('click', options);
|
104
|
-
lastElement.simulate('mouseup', options);
|
105
|
-
|
106
|
-
element.css('cursor', lastElement.css('cursor'));
|
107
|
-
}
|
108
|
-
|
109
|
-
element.css('display', 'block');
|
110
|
-
|
111
|
-
event.preventDefault();
|
112
|
-
event.stopPropagation();
|
113
|
-
});
|
114
|
-
|
115
|
-
iframe.load(function() {
|
116
|
-
iframe.contents().find('*').on('mousemove', function() {
|
117
|
-
wrapper.addClass('hovering');
|
118
|
-
});
|
119
|
-
|
120
|
-
iframe.contents().on('mouseout', function() {
|
121
|
-
wrapper.removeClass('hovering');
|
122
|
-
});
|
123
|
-
});
|
124
|
-
},
|
125
|
-
|
126
96
|
prepare: function(pageElement, configuration) {
|
127
97
|
this._loadIframe(pageElement);
|
128
98
|
},
|
129
99
|
|
130
100
|
activating: function(pageElement, configuration) {
|
101
|
+
this._listenToHeightMessage(pageElement);
|
131
102
|
this._loadIframe(pageElement);
|
132
103
|
this.resize(pageElement, configuration);
|
133
104
|
this.customizeLayout(pageElement, configuration);
|
134
|
-
this._initEventSimulation(pageElement.find('.iframe_overlay'), pageElement.find('iframe'), pageElement.find('.iframeWrapper'));
|
135
105
|
},
|
136
106
|
|
137
107
|
activated: function(pageElement, configuration) {},
|
138
108
|
|
139
109
|
deactivating: function(pageElement, configuration) {
|
110
|
+
this._stopListeningToHeightMessages();
|
140
111
|
$('body').removeClass('bigScreen');
|
141
112
|
},
|
142
113
|
|
@@ -159,19 +130,56 @@ pageflow.react.registerPageTypeWithDefaultBackground('chart', _.extend({
|
|
159
130
|
embeddedEditorViews: function() {
|
160
131
|
return {
|
161
132
|
'iframe': {
|
162
|
-
view: pageflow.chart.IframeEmbeddedView
|
163
|
-
options: {propertyName: 'scraped_site_id'}
|
133
|
+
view: pageflow.chart.IframeEmbeddedView
|
164
134
|
}
|
165
135
|
};
|
166
136
|
},
|
167
137
|
|
168
138
|
_loadIframe: function(pageElement) {
|
169
|
-
|
170
|
-
|
139
|
+
if (this.loadIframeCalled) {
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
|
143
|
+
this.loadIframeCalled = true;
|
171
144
|
|
172
|
-
|
173
|
-
|
145
|
+
pageflow.consent.requireAccepted('datawrapper').then(function(result) {
|
146
|
+
if (result === 'fulfilled') {
|
147
|
+
pageElement.find('iframe[data-src]').each(function() {
|
148
|
+
var iframe = $(this);
|
149
|
+
|
150
|
+
if (!iframe.attr('src')) {
|
151
|
+
iframe.attr('src', iframe.data('src'));
|
152
|
+
}
|
153
|
+
});
|
174
154
|
}
|
175
155
|
});
|
156
|
+
},
|
157
|
+
|
158
|
+
_listenToHeightMessage: function(pageElement) {
|
159
|
+
this._messageListener = this._messageListener || function(event) {
|
160
|
+
if (typeof event.data['datawrapper-height'] !== 'undefined') {
|
161
|
+
var iframe = pageElement.find('iframe')
|
162
|
+
|
163
|
+
for (var chartId in event.data['datawrapper-height']) {
|
164
|
+
if (iframe.attr('src').indexOf(chartId) > -1) {
|
165
|
+
var iframeWrapper = pageElement.find('.iframeWrapper')
|
166
|
+
var height = event.data['datawrapper-height'][chartId] + 'px';
|
167
|
+
|
168
|
+
if (iframeWrapper.css('height') !== height) {
|
169
|
+
var scroller = pageElement.find('.scroller');
|
170
|
+
|
171
|
+
iframeWrapper.css('height', height);
|
172
|
+
scroller.scroller('refresh');
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
window.addEventListener('message', this._messageListener);
|
180
|
+
},
|
181
|
+
|
182
|
+
_stopListeningToHeightMessages: function() {
|
183
|
+
window.removeEventListener('message', this._messageListener);
|
176
184
|
}
|
177
185
|
}, pageflow.defaultPageContent));
|
@@ -1,28 +1,11 @@
|
|
1
|
-
.
|
2
|
-
|
3
|
-
display: none;
|
4
|
-
}
|
5
|
-
|
6
|
-
&.failed {
|
7
|
-
.failed.state {
|
8
|
-
display: block;
|
9
|
-
}
|
10
|
-
}
|
11
|
-
|
12
|
-
&.processing {
|
13
|
-
.processing.state {
|
14
|
-
display: block;
|
15
|
-
}
|
16
|
-
}
|
1
|
+
.chart_scraped_site_url_input_view {
|
2
|
+
margin-bottom: 6px;
|
17
3
|
}
|
18
4
|
|
19
5
|
.datawrapper_ad {
|
20
6
|
@include clearfix;
|
21
7
|
|
22
8
|
input {
|
23
|
-
@include button(
|
24
|
-
padding: 3px 10px;
|
25
|
-
width: auto;
|
26
|
-
float: right;
|
9
|
+
@include simple-button("primary");
|
27
10
|
}
|
28
11
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
@include pageflow-page-type-pictograms("chart");
|
2
2
|
|
3
3
|
$chart-background: $basic-background-color;
|
4
|
+
$chart-iframe-base-height: 400px !default;
|
4
5
|
|
5
6
|
.chart_page {
|
6
7
|
.iframeWrapper {
|
@@ -8,5 +9,7 @@ $chart-background: $basic-background-color;
|
|
8
9
|
opacity: 0.95;
|
9
10
|
background-color: $chart-background;
|
10
11
|
}
|
12
|
+
|
13
|
+
height: $chart-iframe-base-height;
|
11
14
|
}
|
12
15
|
}
|
@@ -4,7 +4,6 @@
|
|
4
4
|
.iframeWrapper {
|
5
5
|
margin-bottom: 40px;
|
6
6
|
pointer-events: all;
|
7
|
-
height: 400px;
|
8
7
|
position: relative;
|
9
8
|
|
10
9
|
@media (min-width: 1500px) {
|
@@ -63,18 +62,6 @@
|
|
63
62
|
}
|
64
63
|
}
|
65
64
|
|
66
|
-
.iframe_overlay {
|
67
|
-
.has_mobile_platform & {
|
68
|
-
position: absolute;
|
69
|
-
top: 0;
|
70
|
-
left: 0;
|
71
|
-
width: 100%;
|
72
|
-
height: 100%;
|
73
|
-
pointer-events: all;
|
74
|
-
background-color: transparent;
|
75
|
-
}
|
76
|
-
}
|
77
|
-
|
78
65
|
.text_position_right &.widescreened {
|
79
66
|
@include position-end(auto);
|
80
67
|
@include position-start(8%);
|
@@ -103,19 +90,18 @@
|
|
103
90
|
}
|
104
91
|
}
|
105
92
|
|
106
|
-
&:hover .bigscreen_toggler
|
93
|
+
&:hover .bigscreen_toggler {
|
107
94
|
opacity: 1;
|
108
95
|
}
|
109
96
|
|
110
97
|
.bigScreen & {
|
111
98
|
position: absolute;
|
112
99
|
width: 86% !important;
|
113
|
-
height: 87%;
|
114
100
|
top: 10%;
|
115
101
|
left: 5% !important;
|
116
102
|
z-index: 201;
|
117
103
|
margin-top: 0 !important;
|
118
|
-
max-height:
|
104
|
+
max-height: 84% !important;
|
119
105
|
|
120
106
|
.bigscreen_toggler {
|
121
107
|
background-position: -25px 0;
|
@@ -132,4 +118,11 @@
|
|
132
118
|
}
|
133
119
|
}
|
134
120
|
}
|
121
|
+
|
122
|
+
.opt_out_wrapper {
|
123
|
+
position: absolute;
|
124
|
+
top: 100%;
|
125
|
+
right: 0;
|
126
|
+
left: 0;
|
127
|
+
}
|
135
128
|
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Pageflow
|
2
2
|
module Chart
|
3
3
|
module ScrapedSitesHelper
|
4
|
+
include RevisionFileHelper
|
5
|
+
|
4
6
|
IFRAME_ATTRIBUTES = {
|
5
7
|
style: 'width: 100%; height: 100%',
|
6
8
|
scrolling: 'auto',
|
@@ -11,22 +13,29 @@ module Pageflow
|
|
11
13
|
webkitallowfullscreen: 'true'
|
12
14
|
}
|
13
15
|
|
14
|
-
def scraped_site_iframe(
|
15
|
-
scraped_site = ScrapedSite.find_by_id(scraped_site_id)
|
16
|
+
def scraped_site_iframe(configuration)
|
16
17
|
data_attributes = {}
|
17
18
|
|
18
|
-
if
|
19
|
+
if configuration['chart_url']
|
19
20
|
data_attributes = {
|
20
|
-
src:
|
21
|
+
src: configuration['chart_url'].gsub(/^https?:/, '')
|
22
|
+
}
|
23
|
+
elsif (scraped_site = find_scraped_site(configuration))
|
24
|
+
data_attributes = {
|
25
|
+
src: scraped_site.html_file_url,
|
26
|
+
customize_layout: true,
|
27
|
+
use_custom_theme: scraped_site.use_custom_theme ? true : nil
|
21
28
|
}
|
22
|
-
|
23
|
-
if scraped_site.use_custom_theme
|
24
|
-
data_attributes[:use_custom_theme] = true
|
25
|
-
end
|
26
29
|
end
|
27
30
|
|
28
31
|
content_tag(:iframe, '', IFRAME_ATTRIBUTES.merge(data: data_attributes))
|
29
32
|
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def find_scraped_site(configuration)
|
37
|
+
find_file_in_entry(ScrapedSite, configuration['scraped_site_id'])
|
38
|
+
end
|
30
39
|
end
|
31
40
|
end
|
32
41
|
end
|