Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Output share icons to link ui dialog window

ZachTRicee023c32a68f6
diff --git a/web/js/link/wv.link.ui.js b/web/js/link/wv.link.ui.js
index 8e5dd352f..15b9ec901 100644
--- a/web/js/link/wv.link.ui.js
+++ b/web/js/link/wv.link.ui.js
@@ -140,6 +140,65 @@ wv.link.ui = wv.link.ui || function(models, config) {
$("#wv-link-shorten-check").prop("checked", false);
+ function ShareInit() {
+
+ class ShareApp extends React.Component {
+ render() {
+
+ return React.createElement('div', {},
+ // facebook
+ // https://www.facebook.com/dialog/feed?app_id=yourFacebookAppId&display=popup&caption=React%20Social!&link=https%3A%2F%2Fgithub.com%2Folahol%2Freact-social%2F&picture=&redirect_uri=https%3A%2F%2Fwww.facebook.com%2F
+ // https://www.facebook.com/dialog/feed?
+ // app_id=145634995501895
+ // &display=popup&caption=An%20example%20caption
+ // &link=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F
+ // &redirect_uri=https://developers.facebook.com/tools/explorer
+
+ React.createElement("a", {href: `${this.props.link}`, title: "Share via Facebook"},
+ React.createElement("i", {className: "fa fa-facebook-square"})
+ ),
+
+ // twitter
+ // https://twitter.com/intent/tweet?text=React%20Social!%20https%3A%2F%2Fgithub.com%2Folahol%2Freact-social%2F
+ React.createElement("a", {href: `${this.props.link}`, title: "Share via Facebook"},
+ React.createElement("i", {className: "fa fa-twitter-square"})
+ ),
+
+ // google plus
+ React.createElement("a", {href: `${this.props.link}`, title: "Share via Facebook"},
+ React.createElement("i", {className: "fa fa-google-plus-square"})
+ ),
+
+ // email
+ React.createElement("a", {href: `${this.props.link}`, title: "Share via Facebook"},
+ React.createElement("i", {className: "fa fa-envelope-square"})
+ ));
+ }
+ }
+
+ // JSX code
+ // render: function () {
+ // var link = "https://github.com/olahol/react-social/",
+ // facebookAppId = "yourFacebookAppId",
+ // message = "React Social!";
+ //
+ // return (
+ // <div>
+ // <FacebookButton title="Share via Facebook" message={message} appId={facebookAppId} url={link} element="a" className="">
+ // <i className="fa fa-facebook-square"/>
+ // </FacebookButton>
+ // </div>
+ // );
+ // }
+
+ ReactDOM.render(React.createElement(ShareApp,
+ {link: 'https://github.com/olahol/react-social/'},
+ {facebookAppId: "yourFacebookAppId"},
+ {message: "React Social!"}),
+ $('#wv-link-shorten')[0]);
+ }
+ ShareInit();
+
};
init();
diff --git a/web/js/share/wv.share.widget.js b/web/js/share/wv.share.widget.js
new file mode 100644
index 000000000..6675359ec
--- /dev/null
+++ b/web/js/share/wv.share.widget.js
@@ -0,0 +1,27 @@
+/*
+ * NASA Worldview
+ *
+ * This code was originally developed at NASA/Goddard Space Flight Center for
+ * the Earth Science Data and Information System (ESDIS) project.
+ *
+ * Copyright (C) 2013 - 2016 United States Government as represented by the
+ * Administrator of the National Aeronautics and Space Administration.
+ * All Rights Reserved.
+ *
+ * Licensed under the NASA Open Source Agreement, Version 1.3
+ * http://opensource.gsfc.nasa.gov/nosa.php
+ */
+var wv = wv || {};
+
+wv.share = wv.share || {};
+
+wv.share = wv.share || function() {
+ var self = {};
+ self.init = function() {
+ //mount react component
+ self.reactComponent = ReactDOM.render(<App />, $('#wv-link-button')[0]);
+ };
+
+ self.init();
+ return self;
+};
diff --git a/web/js/wv.main.js b/web/js/wv.main.js
index 65d2570b8..e74b2a6dd 100644
--- a/web/js/wv.main.js
+++ b/web/js/wv.main.js
@@ -121,7 +121,7 @@ $(function() {
models.date = wv.date.model(config, { initial: initialDate });
models.map = wv.map.model(models, config);
models.link = wv.link.model(config);
-
+
models.link
.register(models.proj)
.register(models.layers)
@@ -182,7 +182,7 @@ $(function() {
ui.timeline.config = wv.date.timeline.config(models, config, ui);
ui.timeline.input = wv.date.timeline.input(models, config, ui);
if ( config.features.animation ) {
- ui.anim = {};
+ ui.anim = {};
ui.anim.rangeselect = wv.anim.rangeselect(models, config, ui); // SETS STATE: NEEDS TO LOAD BEFORE ANIMATION WIDGET
ui.anim.widget = wv.anim.widget(models, config, ui);
ui.anim.gif = wv.anim.gif(models, config, ui);
@@ -192,7 +192,7 @@ $(function() {
ui.dateLabel = wv.date.label(models);
}
if (config.startDate) {
- if(!wv.util.browser.small) { // If mobile device, do not build timeline
+ if(!wv.util.browser.small) { // If mobile device, do not build timeline
timelineInit();
}
ui.dateWheels = wv.date.wheels(models, config);
@@ -320,4 +320,3 @@ $(function() {
wv.util.wrap(main)();
});
-