Unverified Commit e972abca authored by amystamile's avatar amystamile Committed by GitHub
Browse files

Code Cleanup (#58)

parent 36bca5a3
Loading
Loading
Loading
Loading

.github/workflows/jekyll.yml

deleted100644 → 0
+0 −27
Original line number Diff line number Diff line
# This script deploys your website automatically
name: CI

# Only trigger this script when you push to the master branch
on:
  push:
    branches: [ master ]

# Specify the tasks to run when this script gets triggered
jobs:
  build:
    runs-on: ubuntu-latest

    # Download our master branch
    steps:
    - uses: actions/checkout@v2

    # Run our deployment command
    - name: Deploying the static website to gh-pages
      run: | 
        npm install
        git config --global user.name ${{ secrets.USER_NAME }}
        git config --global user.email ${{ secrets.USER_EMAIL }}
        git remote set-url origin https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/GeoSTAC/CartoCosmos-with-STAC.git
        npm run deploy
      working-directory: app

AutoComplete/README.md

deleted100644 → 0
+0 −7
Original line number Diff line number Diff line
AutoComplete Demoing Guide

Step 1: Download zip file.

Step 2: Extract zip file.

Step 3: Run index.html in browser.
+0 −22
Original line number Diff line number Diff line

#autoComplete{
  border-style: solid;
  border-width: 2px;
  color:   #000000;
  height:     21px;
  width:     150px;
  font-size: 1.2em;
  left: 40px;
  top: 14px;
  position: relative;
}

#autoComplete_list{position: relative; padding:0;left:0;right:0;margin-top:0;margin-left:auto;margin-right:auto;width:18rem;transition:all .1s ease-in-out;-webkit-transition:all -webkit-transform .1s ease}
.autoComplete_result{/*display: inline-block;*//*margin:0rem auto;padding:.6rem;*//*SAME WIDTH AS TEXTBOX*/max-width:150px;/*RESTYLE, OUTSIDE BORDER OF LIST*/border:.05rem solid #e3e3e3;/*NO BULLETS*/list-style:none;/*text-align:left;*/font-size:1.1rem;color:#7b7b7b;transition:all .1s ease-in-out;background-color:#fff}
.autoComplete_result::selection{color:rgba(#fff,0);background-color:rgba(#fff,0)}
.autoComplete_result:last-child{border-radius:0 0 1rem 1rem}
.autoComplete_result:hover{cursor:pointer;background-color:rgba(255,248,248,.9);border-left:2px solid rgb(0, 0, 0);border-right:2px solid rgb(0, 0, 0);border-top:2px solid transparent;border-bottom:2px solid transparent}
.autoComplete_result:focus{outline:0;background-color:rgba(255,248,248,.9);border-left:2px solid rgb(0, 0, 0);border-right:2px solid rgb(0, 0, 0);border-top:2px solid transparent;border-bottom:2px solid transparent}
.autoComplete_highlighted{opacity:1;color:rgb(0, 0, 0);font-weight:700}
.autoComplete_highlighted::selection{color:rgba(#fff,0);background-color:rgba(#fff,0)}
.autoComplete_selected{cursor:pointer;background-color:rgba(255,248,248,.9);border-left:2px solid rgb(0, 0, 0);border-right:2px solid rgb(0, 0, 0);border-top:2px solid transparent;border-bottom:2px solid transparent}@media only screen and (max-width:600px){#autoComplete{width:5rem}}
 No newline at end of file

AutoComplete/index.html

deleted100644 → 0
+0 −28
Original line number Diff line number Diff line
<!DOCTYPE html>
<html lang="en">    
	<!-- Includes the CDN for the autcomplete functionality.-->  
	<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@7.2.0/dist/js/autoComplete.min.js"></script>
	<!-- Includes JQuery -->
    <script
			  src="https://code.jquery.com/jquery-3.4.1.js"
			  integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
			  crossorigin="anonymous">
	</script>
	<!-- Declares the stylesheet for the page.-->
	<link rel="stylesheet" href="./css/planetarynames.css">
	<script src="./js/render.js"></script>
	<!-- Declares id of input field which will be used for the autcomplete.-->
	<input id="autoComplete" tabindex="1" onfocusout="unrenderBox()" onfocusin="renderBox()"></input>  <!-- Default "id" value = "autoComplete"> -->
	<body>
	<!-- Gets the other autocomplete file library for use (Doesn't look like I need this, keeping it for now just in case).
	<script src="./autoComplete.js/dist/js/autoComplete.min.js"></script> -->
	<!-- Gets require.js for use in autcomplete.-->
	<script src="./js/require.js"></script>
	<!-- Gets the current server-->
	<script src="./js/getServer.js"></script>
	<!-- Declares main js file for autocomplete functionality.-->
	<script src="./js/customIndex.js"></script>

</body>
	
</html>

AutoComplete/js/customIndex.js

deleted100644 → 0
+0 −97
Original line number Diff line number Diff line
/**
 * @class autoComplete
 * @classdesc Declares a new autocomplete that is ran when the user enters more data into the autocomplete box.
 */
var newAutocomplete = new autoComplete({
    //Defines the data that will be returned inside of the autocomplete.
    /**
     * @property data
     * @description Gets JSON array of features.
     */
    data: { 
      //Gets data source for autocomplete asyncronusly.
      src: async () => {
        // API key token
        const token = "this_is_the_API_token_number";
        //Const of value entered for query.
        const query = document.querySelector("#autoComplete").value;
        //Returns Json array of values that contain the query inside of them.
        return nameArray;
      },
      //Searches the returned data based off of the name property.
      key: ["clean_feature"],
      //Does not cache search.
      cache: false
    },
    //Returns the query (OPTIONAL, kept in for now to make sure nothing breaks when it is removed.).
    query: {   
          //Can be used to change the query by looking for certain values                            
          manipulate: (query) => {
            //Returns the query
            return query;
          }
    },
    //Triggers an event which displays the current status of the query in the console log.
    trigger: {
      //Trigger runs when searchbox is selected, clicked out of, or has been typed in.
        event: ["input", "focusin", "focusout"]
        
      },
    //Sorts values in descending order.
    sort: (a, b) => {                    
        if (a.match < b.match) return -1;
        if (a.match > b.match) return 1;
        return 0;
    },
    //Value displayed in searchbox before any value is entered.
    placeHolder: "Enter feature here...", 
    //ID of input/searchbox which will be used.    
    selector: "#autoComplete",       
    //Does not display autocomplete results list until the characters entered into the searchbox exceed the threshold.   
    threshold: 1,       
    //Displays search with strict (starts with) results and not loose (contains) results.                                     
    searchEngine: "strict",  
    //Defines attributes for the results list.            
    resultsList: {
        //Renders/displays the results list.
        render: true,   
        //Edits containter id of the results list to be #autoComplete_list.                  
        container: source => {
            //Sets id to #autoComplete_list.
            source.setAttribute("id", "#autoComplete_list");
        },
        //Selects the input which the results list will be using.
        destination: document.querySelector("#autoComplete"),
        //Sets location of results list relative to the destination (above), can be afterend, afterbegin, beforebegin, and beforeend.
        position: "afterend",
        //Sets element type of the results list (ul, div, span, etc...).
        element: "ul",
    },
    //Sets the max number of results that can be returned in a results list for a query (10).
    maxResults: 10,    
    //Highlights query string characters inside of the results list.                     
    highlight: true,     
    //Edits each item on the list.                  
    resultItem: {                          
        content: (data, source) => {
            //Displays list items only when they match the query.
            source.innerHTML = data.match;
        },
        //Displays result items as list items.
        element: "li"
    },

    /**
     * @function onSelection
     * @description Runs a script on the selection of a result item, will be used to edit the url for search queries.
     * @param {JSON} feedback
     */
    onSelection: feedback => {             
       //Creates string used for searching with the selected name.
        var URLString = ("https://planetarynames.wr.usgs.gov/SearchResults?feature=" + feedback.selection.value.clean_feature);
        //Replaces spaces with %20 for encoded URL string.
        var encodedURLString = URLString.replace(" ", "%20");
        //Puts web address into browser.
        window.location.href = encodedURLString;
    }
});
 No newline at end of file
Loading