forked from crismaproject/worldstate-analysis-widgets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
2,539 additions
and
876 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ app/bower_components | |
target | ||
.checkDependencies | ||
test-results.xml | ||
private/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Scenario Analysis</title> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<script src="bower_components/seamless/build/seamless.parent.js" type="text/javascript"></script> | ||
</head> | ||
<body> | ||
<script type="text/javascript"> | ||
window.onload = function () { | ||
// Turns the iframe into a seamless iframe. | ||
window.seamless(document.getElementById('scenarioanalysis')); | ||
}; | ||
</script> | ||
|
||
<iframe id="scenarioanalysis" src="index.html"></iframe> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//<script type="text/javascript"> | ||
'use strict'; | ||
/* global $ */ | ||
/* jshint ignore:start */ | ||
if (typeof $ === 'undefined') { | ||
var $ = jQuery; | ||
} | ||
if (typeof $ === 'undefined') { | ||
var $ = window.jQuery; | ||
} | ||
/* jshint ignore:end */ | ||
|
||
window.Drupal.behaviors.myBehavior = { | ||
attach: function (context, drupalSettings) { | ||
// Using once() to apply the scenarioAnalysisIFrameBehavior effect when you want to run just one function. | ||
$(window, context).once('scenarioAnalysisIFrameBehavior').each(function () { | ||
// now using the csisHelpers Module (https://github.com/clarity-h2020/csis-helpers-module) | ||
// to get node and group id! | ||
var groupId = drupalSettings.csisHelpers.entityinfo.study; | ||
|
||
// FIXME: this does not work if the iframe is embedded in a separate node that is then referenced | ||
// from the node containg the actual data! | ||
var nodeId = drupalSettings.csisHelpers.entityinfo.step; | ||
|
||
// ugly workaround parsing the node id from URL study/$1/step/$2 | ||
nodeId = window.location.pathname.split('/')[4]; | ||
|
||
console.log('groupId = ' + groupId + ', nodeId = ' + nodeId); | ||
var connectCount = 0; | ||
// for some unknown the reason angular directive controler of the embedded child iframe | ||
// does not recieve the event when it's not fired from the onConnect method. | ||
var scenarioAnalysisApp = window.seamless(document.getElementById('scenario-analysis'), | ||
{onConnect: function () { | ||
// FIXME: for some unknown reason, onConnect is called if no child frame has actively connected | ||
// by invoking seamless.connect() resulting in the onConnect function called twice! | ||
if (connectCount === 1) { | ||
scenarioAnalysisApp.send({ | ||
nodeId: nodeId, | ||
groupId: groupId | ||
}); | ||
} else { | ||
//ignore | ||
//console.log('pre/re connection #:' + connectCount); | ||
} | ||
connectCount++; | ||
}}); | ||
}); | ||
} | ||
}; | ||
//</script> | ||
//<iframe id="scenario-analysis" src="/apps/scenario-analysis/app/index.html"></iframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ angular.module( | |
criteriaEmphasis : item.criteriaEmphasis | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
|
Oops, something went wrong.