Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html lang="en" ng-app='app'>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
  <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"/>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<title></title>
</head>
<body>
  <!-- Modal -->
  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title" id="myModalLabel">Saved items</h4>
      </div>
      <div class="modal-body">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div> 
  <!-- End modal --> 
   <div class="wrapper">
    <div id="content">
     
   <div id="menu" class="col-xs-12 col-md-12">
      <button id="modal" role="button" class="btn btn-lg" data-toggle="modal" data-target="#myModal"><strong>Saved items</strong></button>

 </div>
      <h3 id="wp"></h3>
   <div id="search">
      <input title="Please, separate tags with commas" id="textSearch" placeholder="Search for..." autofocus></input>
      <button class="btn find" id="notRandom"><i class="fa fa-search" aria-hidden="true"></i></button>
     </div>

     <div id="helpDiv"></div>
  <div id='addBlock'></div>
       </div>
    <div class="footer">Made by <a href="" target="_blank" id="footer">Sergey Karagichev </a>© 2017. All Rights Reversed</div>
  </div>
</body>
</html>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
}
body {
  font-color: #323232;

    background: #E1D3B5;
  
}
html,
body {
  height: 100%;
}
.wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#content {
  flex: 1 0 auto;
}
.footer {
  flex: 0 0 auto;
  color: black;
  font-size: 12px;
  border: none;
  background: rgba(100, 120, 100, 0.3);
  text-align: center;
  height: 50px;
  padding: 20px;
  font-family: "Orbitron", sans-serif;
}
#footer {
  text-decoration: none;
  color: rgb(100, 120, 100);
}
#addBlock{
  margin-left:1%;
}

#modal {
   height: 60px;
   box-shadow: 0 0 10px black;
   outline: none!important;
   border: none;
   background: DimGray;
   font-family: 'Archivo Black', sans-serif;
}
#menu {
  height: 70px;
  background: rgba(105,105,105,0.9);
  display: flex;
  justify-content: flex-end;
  align-items:center;
}
.block{
  margin:1%;
  margin-left:25%;
  margin-right:25%;
  padding:1%;
  box-shadow: 0 0 30px black;
  border-top-left-radius: 10%;
  border-bottom-right-radius: 20%;
  text-align: center;
  
}
.comm {
  box-shadow: 0 0 5px black;
  display: flex;
  justify-content: space-between;
  align-items: center;
 margin:1%;
  padding:1%;
  border-radius: 5px;
 
  
}
.delComment {
  border: none;
  outline: none!important;
   font-family: 'Archivo Black', sans-serif;
   background: rgba(105,105,105,0.3);
   box-shadow: 0 0 5px black;
}
.close, .close1{
  font-size:250%;
  
}
textarea{
  margin:1%;
  width:90%;
  height: 70px;
  margin-bottom: -3px;
  border-radius: 5px;
  border: none;
  outline: none;
  resize: none;
  box-shadow: 0 0 5px white;
  font-size: 20px;
}
.add_comments{
  width:18%;
  color: black;
  border: none;
  outline: none!important;
  margin-left: 5px;
   font-family: 'Archivo Black', sans-serif;
  background: rgba(105,105,105,0.3);
  box-shadow: 0 0 5px black;
}
.add_comments:hover {
  color:#EBE9DD;
}
img{
  margin-left:3%;
}
.views, .likes, .tags{
  margin-left:2%;
  padding:1%;
  font-size:20px;
  
}
.teg{
  padding:1%;
  width:20%
}
.save, .delete, .delete1, .close1 {
  width: 30%;
  display: block;
  margin: 0 auto;
  border: none;
  outline: none!important;
  margin-top:2%;
   font-family: 'Archivo Black', sans-serif;
  box-shadow: 0 0 5px black;
   background: rgba(105,105,105,0.3);
}
.save:hover {
  color: #EBE9DD;
}
.btn-danger {
 margin-left: 3%; 
 border: none;
 outline: none!important;
   font-family: 'Archivo Black', sans-serif;
 
}
.btn-primary {
  font-family: 'Archivo Black', sans-serif;
  border: none;
 outline: none!important;
 
}
.link {
  text-decoration: none!important;
  font-family: 'Archivo Black', sans-serif;
  color:#9C28E9;
}

.link:link {
  color: black;
}
.link:visited {
  color:#7753FD;
}
.link:active {
  color: white;
}
.link:hover {
  color: #EBE9DD;
}
.find {
  background: rgb(225,211,181);
  outline: none!important;
  font-size: 16px;
  color: rgb(80,80,80);
  font-size: 50px;
}

#textSearch {
  width: 80%;
  height: 60px;
  border-top: none;
  border-left: none;
  border-right: none;
  border-bottom-width: 2px;
  border-color: rgb(80,80,80);
  outline: none;
  font-size: 25px;
  background: rgb(225,211,181);
  color: rgb(80,80,80);
  
}
#search {
  text-align: center;
}
#countItem{
  float:right;
  width:30px;
  height:30px;
  border-radius:100%;
  background:silver;
   border: none;
  outline: none!important;

}
              
            
!

JS

              
                $(document).ready(function() {
var cou="Saved items"+"&nbsp;"+'<button id="countItem">'+localStorage.length+'</button>'
$("#modal").html(cou);
    function search() {
        $.getJSON("https://pixabay.com/api/?key=2980920-46f1aa264b036ffc6e45ebad0&orientation=vertical&q=robot&min_height=500", function(data) {
            var input = $("#textSearch").val();
            var count = 0;
            data.hits.forEach(function(el) {
                var tags = el.tags.split(/\s*,\s*/).map(el => el.trim());
                var str = input.trim().split(/\s*,\s*/);
                var block = "<div style='background: #E1D3B5'class='block'><button class='btn save'>Save</button><button type='button' name='index' class='close'><i class='fa fa-trash' aria-hidden='true'></i></button><span class='tags'>" + el.tags + "</span><br><img src='" + el.previewURL + "'><br><span class='views'><i class='fa fa-eye' aria-hidden='true'></i>" + el.views + "</span><span data-value='1' class='likes'><i class='fa fa-heart-o' aria-hidden='true'></i>" + el.likes + "</span><p><a class='link' target='_blank' href=" + el.pageURL + " title='go to the original page'>Source link</a></p> <button class=' btn btn-primary'>Approve&nbsp;<i class='fa fa-thumbs-o-up' aria-hidden='true'></i></button><button class='btn btn-danger'>Decline&nbsp;<i class='fa fa-thumbs-o-down' aria-hidden='true'></i></button><div class='comments'></div><textarea placeholder='Add your comment...' class='text' name=''></textarea><br><button class='add_comments btn'><i class='fa fa-check' aria-hidden='true'></i></button><br></div>";
                if (input === "") {
                    $('#addBlock').append(block);
                } else {
                    if (str.every(el => tags.includes(el))) {
                        $('#addBlock').append(block);
                    } else {
                        count++;
                   }
                }
            })
            if (count === data.hits.length) {
                $('#helpDiv').html("<div class='well' style='background: Cornsilk; color: Coral'>" +
                    "Unfortunately, your search returned no results...<br>Please, enter the correct query!</div>").fadeIn();
            }
            $('.save').on('click', function() {
                if (!$(this).hasClass('active')) {
                    $(this).html('Delete');
                    var key = "pic" + localStorage.length;
                 
                    var str = $(this).parent().html()
                    var str1 = str.replace('<button class="btn save">Delete</button>', '').replace('<button type="button" name="index" class="close"><i class="fa fa-trash" aria-hidden="true"></i></button>', '<button type="button" name="index" class="close1 btn"><i class="fa fa-trash" aria-hidden="true"></i></button>')
                    $(this).parent().attr('data-value', key)
                    var color= $(this).parent().attr("style");
                    var inp = "<div style='"+color+"' data-value=" + key + " class='block'>" + str1 + "</div>"
                    localStorage.setItem(key, inp);
                  $("#countItem").html(localStorage.length);
                
                 
                } else {
                 
                    $(this).html('Save');
                    var del_key = $(this).parent().attr("data-value");
                    localStorage.removeItem(del_key);
                 $("#countItem").html(localStorage.length);
                  
                }
                $(this).toggleClass('active');
            });
            $(".btn-primary").on("click", function() {
                var n = 1;
                var dVal = $(this).parent().find(".likes").attr("data-value");
                if (dVal === undefined) {
                    n = 2;
                }
                var str = $(this).parent().find(".likes").text();
                $(this).parent().find(".likes").html("<i class='fa fa-heart-o' aria-hidden='true'></i>" + (Number(str) + n));
                $(this).parent().css("background", "#E3FFD4");
                $(this).attr("disabled", "disabled").css("color", "black");
                $(this).parent().find(".btn-danger").removeAttr("disabled").css("color", "white");
                $(this).parent().find(".likes").removeAttr("data-value");
            })

            $(".btn-danger").on("click", function() {
                var n = 1;
                var dVal = $(this).parent().find(".likes").attr("data-value");
                if (dVal === undefined) {
                    n = 2;
                }
                var str = $(this).parent().find(".likes").text();
                $(this).parent().find(".likes").html("<i class='fa fa-heart-o' aria-hidden='true'></i>" + (Number(str) - n));
                $(this).parent().css("background", "#FCCECE");
                $(this).attr("disabled", "disabled").css("color", "black");
                $(this).parent().find(".btn-primary").removeAttr("disabled").css("color", "white");
                $(this).parent().find(".likes").removeAttr("data-value");
            });

            $(".add_comments").on("click", function() {
                var str = $(this).parent().find(".text").val();
                if (str === "") {
                    return;
                }
                $(this).parent().find(".comments").append("<div class='comm'>" + str + "<button class='delComment'>Delete</button></div>");
                $(".delComment").click(function() {
                    $(this).parent().remove();
                });
            });
            $(".close").click(function() {
                $(this).parent().remove();
            });

          
        });
    }
    search();
    $("#modal").on("click", function() {
        $(".modal-body").empty();
        for (var i in localStorage) {
            $(".modal-body").append(localStorage[i]);
            $(".close1").on("click", function() {
                var del_key = $(this).parent().attr("data-value");
                $(this).parent().remove();
                localStorage.removeItem(del_key);
            $("#countItem").html(localStorage.length);
            })
        }
    });
    $("#notRandom").on("click", function() {
        search();
        $("#textSearch").on("keyup", function() {
            var val = $(this).val();
            if (val.length === 0) {
                $("#helpDiv").fadeOut(500);
                $("#addBlock").empty();
                 search();
            }
        });
        $(".block").fadeOut();
        $('#helpDiv').fadeOut();
    });
    $("#textSearch").keyup(function(e) {
        if (e.keyCode === 13) {
            $("#notRandom").click();
        }
    })
  
});
              
            
!
999px

Console