Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Removed unneeded wv.link.ui and refernces.

ZachTRice1def505e3834
diff --git a/web/index.html b/web/index.html
index 82afa8faa..dfe38e83b 100644
--- a/web/index.html
+++ b/web/index.html
@@ -263,8 +263,6 @@
<!-- link.dev --> <script type="text/javascript" src="js/link/wv.link.model.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/link/wv.link.widget.js"></script>
- <!-- link.dev -->
- <!-- <script type="text/javascript" src="js/link/wv.link.ui.js"></script> -->
<!-- link.dev --> <script type="text/javascript" src="js/wv.feedback.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/wv.tour.js"></script>
@@ -274,18 +272,17 @@
</head>
<body>
- </div>
<div data-role="page" id="app">
<div data-role="content">
- <ul id="wv-toolbar">
- <li id="wv-link-button" class="wv-toolbar-button">
- <div id="share-modal"></div>
- </li>
- <li id="wv-proj-button" class="wv-toolbar-button"></li>
- <li id="wv-image-button" class="wv-toolbar-button"></li>
- <li id="wv-info-button" class="wv-toolbar-button"></li>
- </ul>
+ <ul id="wv-toolbar">
+ <li id="wv-link-button" class="wv-toolbar-button">
+ <div id="share-modal"></div>
+ </li>
+ <li id="wv-proj-button" class="wv-toolbar-button"></li>
+ <li id="wv-image-button" class="wv-toolbar-button"></li>
+ <li id="wv-info-button" class="wv-toolbar-button"></li>
+ </ul>
<div id="wv-logo"></div>
<section id="productsHolder">
diff --git a/web/js/link/wv.link.ui.js b/web/js/link/wv.link.ui.js
deleted file mode 100644
index e23398071..000000000
--- a/web/js/link/wv.link.ui.js
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * 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 - 2014 United States Government as represented by the
- * Administrator of the National Aeronautics and Space Administration.
- * All Rights Reserved.
- */
-
-var wv = wv || {};
-wv.link = wv.link || {};
-
-wv.link.ui = wv.link.ui || function(models, config) {
-
- var self = {};
- var id = "wv-link-button";
- var selector = "#" + id;
- var $button;
- var $label;
-
- var init = function() {
-
- $button = $("<input></input>")
- .attr("type", "checkbox")
- .attr("id", "wv-link-button-check");
- $label = $("<label></label>")
- .attr("for", "wv-link-button-check")
- .attr("title", "Share this map");
- var $icon = $("<i></i>")
- .addClass("fa")
- .addClass("fa-share-square-o")
- .addClass("fa-2x");
- $label.append($icon);
- $(selector).append($label);
- $(selector).append($button);
- $button.button({
- text: false
- }).click(function() {
- var checked = $("#wv-link-button-check").prop("checked");
- WVC.GA.event('Link', 'Click', 'Share link Button');
- if ( checked ) {
- self.show();
- } else {
- wv.ui.closeDialog();
- }
- });
-
- models.link.events.on("update", replaceHistoryState);
- };
-
- //Calls toQueryString to fetch updated state and returns URL
- var replaceHistoryState = _.throttle(function() {
- if ( wv.util.browser.history ) {
- window.history.replaceState("", "@OFFICIAL_NAME@",
- "?" + models.link.toQueryString());
- }
- }, 2000, {leading: true, trailing: true});
-
- self.show = function() {
-
- var $dialog = wv.ui.getDialog();
- var item = "<div id='wv-link' >" +
- "<input type='text' value='' name='permalink_content' id='permalink_content' readonly/>";
- if ( config.features.urlShortening ) {
- item += "<span autofocus></span><div id='wv-link-shorten'>" +
- "<input type='checkbox' value='' id='wv-link-shorten-check' />" +
- "<label id='wv-link-shorten-label' for='wv-link-shorten-check'>Shorten this link</label>" +
- "</div>";
- }
- item += "</div>";
-
- // Social Sharing
- var defaultLink = encodeURIComponent('http://worldview.earthdata.nasa.gov');
- var fbAppId = '121285908450463';
- var shareMessage = encodeURIComponent('Check out what I found in NASA\'s Worldview!').replace(/'/g, '%27');
- var twMessage = encodeURIComponent('Check out what I found in #NASAWorldview');
-
- item += "<div id='social-share'>";
-
- // Facebook: https://developers.facebook.com/docs/sharing/reference/share-dialog#redirect
- item += "<a id='fb-share' class='icon-link fa fa-facebook fa-2x' href='https://www.facebook.com/dialog/share?" +
- "app_id=" + fbAppId +
- "&href=" + defaultLink +
- "&redirect_uri=" + defaultLink +
- "&display=popup' " +
- "target='_blank' " +
- "title='Share via Facebook!'></a>";
-
- // Twitter: https://dev.twitter.com/web/tweet-button/parameters#web-intent-example
- item += "<a id='tw-share' class='icon-link fa fa-twitter fa-2x' href='https://twitter.com/intent/tweet?" +
- "url=" + defaultLink +
- "&text=" + twMessage + "%20-' " +
- "target='_blank' " +
- "title='Share via Twitter!'></a>";
-
- // Reddit
- // https://www.reddit.com/r/nasa/submit?url=[URL]&title=[TITLE]
- item += "<a id='rd-share' class='icon-link fa fa-reddit fa-2x' href='https://www.reddit.com/r/nasa/submit?" +
- "url=" + defaultLink +
- "&title=" + shareMessage + "' " +
- "target='_blank' " +
- "title='Share via Reddit!'></a>";
-
- // Google Plus: https://developers.google.com/+/web/share/#sharelink-endpoint
- // item += "<a id='gp-share' class='icon-link fa fa-google-plus fa-2x' href='https://plus.google.com/share?" +
- // "url=" + defaultLink + "' " +
- // "target='_blank' " +
- // "title='Share via Google Plus!'></a>";
-
- // Email
- item += "<a id='email-share' class='icon-link fa fa-envelope fa-2x' href='mailto:?" +
- "subject=" + shareMessage +
- "&body=" + shareMessage + "%20-%20" + defaultLink + "' " +
- "target='_self' " +
- "title='Share via Email!'></a>";
-
- item += "</div>";
-
- $dialog.html(item).iCheck({checkboxClass: 'icheckbox_square-grey'});
-
- // If selected during the animation, the cursor will go to the
- // end of the input box
- var updateLink = function() {
- $('#permalink_content').val(models.link.get());
- $("#wv-link-shorten-check").iCheck("uncheck");
- $('#permalink_content').focus();
- $('#permalink_content').select();
- };
-
- models.link.events.on("update", updateLink);
-
- $dialog.dialog({
- dialogClass: "wv-panel wv-link-panel",
- title: "Copy this link to share:",
- show: { effect: "slide", direction: "up" },
- width: 300,
- height: "auto",
- minHeight: 10,
- draggable: false,
- resizable: false,
- autoOpen: false
- }).on("dialogclose", function() {
- $("#wv-link-button-check").prop("checked", false);
- $button.button("refresh");
- models.link.events.off("update", updateLink);
- });
- wv.ui.positionDialog($dialog, {
- my: "left top",
- at: "left bottom+5",
- of: $label
- });
- $(".ui-dialog").zIndex(600);
-
- $('#permalink_content').val(models.link.get());
- $dialog.dialog("open");
- setTimeout(updateLink, 500);
- // When an icon-link is clicked, replace the URL with current encoded link.
- $(".icon-link").on("click", function() {
- var fullEncodedLink = encodeURIComponent(models.link.get());
- var promise = models.link.shorten();
-
- // Set Facebook
- var fbLink = document.getElementById("fb-share");
- fbLink.setAttribute("href", "https://www.facebook.com/dialog/share?" +
- "app_id=" + fbAppId +
- "&href=" + fullEncodedLink +
- "&redirect_uri=" + fullEncodedLink +
- "&display=popup"
- );
-
- // Set Twitter
- var twLink = document.getElementById("tw-share");
- twLink.setAttribute("href", "https://twitter.com/intent/tweet?" +
- "url=" + fullEncodedLink +
- "&text=" + twMessage + "%20-"
- );
-
- // Set Reddit
- var rdLink = document.getElementById("rd-share");
- rdLink.setAttribute("href", "https://www.reddit.com/r/nasa/submit?" +
- "url=" + fullEncodedLink +
- "&title=" + shareMessage
- );
-
- // Set Google Plus
- // var gpLink = document.getElementById("gp-share");
- // gpLink.setAttribute("href", "https://plus.google.com/share?" +
- // "url=" + fullEncodedLink
- // );
-
- // Set Email
- var emailLink = document.getElementById("email-share");
- emailLink.setAttribute("href", "mailto:?" +
- "subject=" + shareMessage +
- "&body=" + shareMessage + "%20-%20" + fullEncodedLink
- );
-
- // If a short link can be generated, replace the full link.
- promise.done(function(result) {
- if ( result.status_code === 200 ) {
- var shortLink = result.data.url;
- var shortEncodedLink = encodeURIComponent(shortLink);
-
- // Set Twitter
- twLink.setAttribute("href", "https://twitter.com/intent/tweet?" +
- "url=" + shortEncodedLink +
- "&text=" + twMessage + "%20-"
- );
-
- // Set Email
- emailLink.setAttribute("href", "mailto:?" +
- "subject=" + shareMessage +
- "&body=" + shareMessage + "%20-%20" + shortEncodedLink
- );
- return false;
- }
- });
- });
-
- //$("#wv-link-shorten-check").button();
- $("#wv-link-shorten-check").on("ifChanged", function() {
- var checked = $("#wv-link-shorten-check").prop("checked");
- if ( checked ) {
- var promise = models.link.shorten();
- WVC.GA.event('Link', 'Check', 'Shorten');
- $("#permalink_content").val("Please wait...");
- promise.done(function(result) {
- if ( result.status_code === 200 ) {
- $('#permalink_content').val(result.data.url);
- } else {
- error(result.status_code, result.status_txt);
- }
- }).fail(function(jqXHR, textStatus, errorThrown) {
- error(textStatus, errorThrown);
- });
- } else {
- $('#permalink_content').val(models.link.get());
- WVC.GA.event('Link', 'Check', 'Lengthen');
- }
- $('#permalink_content').focus();
- $('#permalink_content').select();
- });
-
- var error = function() {
- console.warn("Unable to shorten URL");
- console.warn.apply(console, arguments);
- wv.ui.notify("Unable to shorten the permalink at this time. " +
- "Please try again later.");
- };
-
- $("#wv-link-shorten-check").prop("checked", false);
-
- };
-
- init();
- return self;
-
-};
diff --git a/web/js/link/wv.link.widget.js b/web/js/link/wv.link.widget.js
index ee8d1bdac..42b5bed1b 100644
--- a/web/js/link/wv.link.widget.js
+++ b/web/js/link/wv.link.widget.js
@@ -17,7 +17,6 @@ wv.link.ui = wv.link.ui || function(models, config) {
var self = {};
var id = "wv-link-button";
var selector = "#" + id;
-
var widgetFactory = React.createFactory(WVC.Dialog);
var init = function() {