Created
September 12, 2016 14:53
-
-
Save anonymous/45bc6a5103512208403b05015670484e to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/himeneb
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script> | |
<style id="jsbin-css"> | |
/* Hide un-compiled mustache bindings | |
until the Vue instance is ready */ | |
[v-cloak] { | |
display: none; | |
} | |
*{ | |
margin:0; | |
padding:0; | |
} | |
body{ | |
font:15px/1.3 'Open Sans', sans-serif; | |
color: #5e5b64; | |
text-align:center; | |
} | |
a, a:visited { | |
outline:none; | |
color:#389dc1; | |
} | |
a:hover{ | |
text-decoration:none; | |
} | |
section, footer, header, aside, nav{ | |
display: block; | |
} | |
/*------------------------- | |
The search input | |
--------------------------*/ | |
.bar{ | |
background-color:#5c9bb7; | |
background-image:-webkit-linear-gradient(top, #5c9bb7, #5392ad); | |
background-image:-moz-linear-gradient(top, #5c9bb7, #5392ad); | |
background-image:linear-gradient(top, #5c9bb7, #5392ad); | |
box-shadow: 0 1px 1px #ccc; | |
border-radius: 2px; | |
width: 400px; | |
padding: 14px; | |
margin: 45px auto 20px; | |
position:relative; | |
} | |
.bar input{ | |
background:#fff no-repeat 13px 13px; | |
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU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+WiGkYdYxjCOx5wgFeXUHmtBSzpcCGa+5BJTCjEP+0nKWAT8xqe4ArPGEEVC1hHEbs2oBwdXkM7mj/JLZrad437sCGHOfUtcziutuYu2v8XUFF/4f6vMK/YgAH1HxkBYV60AR31gxkBYd6xAeF3VzMCwvzOBpypX8V4yuFRzX2d2gD/l5yjH4fYQEnzkj4fae5rJulF2sMXVrAsaTWttRFu4Osb+1jEDT71/ZveyhouTch2fINQL9hKefKjuYFfuznXWzXMTabyrvfyIV3M4vhXgAEAUMs7K0J9UJAAAAAASUVORK5CYII=); | |
border: none; | |
width: 100%; | |
line-height: 19px; | |
padding: 11px 0; | |
border-radius: 2px; | |
box-shadow: 0 2px 8px #c4c4c4 inset; | |
text-align: left; | |
font-size: 14px; | |
font-family: inherit; | |
color: #738289; | |
font-weight: bold; | |
outline: none; | |
text-indent: 40px; | |
} | |
/*------------------------- | |
List layout | |
--------------------------*/ | |
ul.list{ | |
list-style: none; | |
width: 500px; | |
margin: 0 auto; | |
text-align: left; | |
} | |
ul.list li{ | |
border-bottom: 1px solid #ddd; | |
padding: 10px; | |
overflow: hidden; | |
} | |
ul.list li img{ | |
width:120px; | |
height:120px; | |
float:left; | |
border:none; | |
} | |
ul.list li p{ | |
margin-left: 135px; | |
font-weight: bold; | |
color:#6e7a7f; | |
} | |
/*------------------------- | |
Grid layout | |
--------------------------*/ | |
ul.grid{ | |
list-style: none; | |
width: 570px; | |
margin: 0 auto; | |
text-align: left; | |
} | |
ul.grid li{ | |
padding: 2px; | |
float:left; | |
} | |
ul.grid li img{ | |
width:280px; | |
height:280px; | |
object-fit: cover; | |
display:block; | |
border:none; | |
} | |
ul.grid li p{ | |
font-size: 12px; | |
font-weight: normal; | |
color:#6e7a7f; | |
width:280px; | |
} | |
</style> | |
</head> | |
<body> | |
<form id="main" v-cloak> | |
<div class="bar"> | |
<!-- Create a binding between the searchString model and the text field --> | |
<input type="text" v-model="searchString" placeholder="Enter your search terms" /> | |
</div> | |
<ul class="grid"> | |
<!-- Render a li element for every entry in the items array. Notice | |
the custom search filter "searchFor". It takes the value of the | |
searchString model as an argument. --> | |
<li v-for="i in articles | searchFor searchString"> | |
<a v-bind:href="i.url"><img v-bind:src="i.image" /></a> | |
<p>{{i.title}}</p> | |
</li> | |
</ul> | |
</form> | |
<script id="jsbin-javascript"> | |
// Define a custom filter called "searchFor". | |
Vue.filter('searchFor', function (value, searchString) { | |
// The first parameter to this function is the data that is to be filtered. | |
// The second is the string we will be searching for. | |
var result = []; | |
if(!searchString){ | |
return value; | |
} | |
searchString = searchString.trim().toLowerCase(); | |
result = value.filter(function(item){ | |
if(item.title.toLowerCase().indexOf(searchString) !== -1){ | |
return item; | |
} | |
}) | |
// Return an array with the filtered data. | |
return result; | |
}) | |
var demo = new Vue({ | |
el: '#main', | |
data: { | |
searchString: "", | |
// The data model. These items would normally be requested via AJAX, | |
// but are hardcoded here for simplicity. | |
articles: [ | |
{ | |
"title": "What You Need To Know About CSS Variables", | |
"url": "http://tutorialzine.com/2016/03/what-you-need-to-know-about-css-variables/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/03/css-variables.jpg" | |
}, | |
{ | |
"title": "Freebie: 4 Great Looking Pricing Tables", | |
"url": "http://tutorialzine.com/2016/02/freebie-4-great-looking-pricing-tables/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/02/great-looking-pricing-tables.jpg" | |
}, | |
{ | |
"title": "20 Interesting JavaScript and CSS Libraries for February 2016", | |
"url": "http://tutorialzine.com/2016/02/20-interesting-javascript-and-css-libraries-for-february-2016/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/02/interesting-resources-february.jpg" | |
}, | |
{ | |
"title": "Quick Tip: The Easiest Way To Make Responsive Headers", | |
"url": "http://tutorialzine.com/2016/02/quick-tip-easiest-way-to-make-responsive-headers/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/02/quick-tip-responsive-headers.png" | |
}, | |
{ | |
"title": "Learn SQL In 20 Minutes", | |
"url": "http://tutorialzine.com/2016/01/learn-sql-in-20-minutes/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/01/learn-sql-20-minutes.png" | |
}, | |
{ | |
"title": "Creating Your First Desktop App With HTML, JS and Electron", | |
"url": "http://tutorialzine.com/2015/12/creating-your-first-desktop-app-with-html-js-and-electron/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2015/12/creating-your-first-desktop-app-with-electron.png" | |
} | |
] | |
} | |
}); | |
</script> | |
<script id="jsbin-source-css" type="text/css">/* Hide un-compiled mustache bindings | |
until the Vue instance is ready */ | |
[v-cloak] { | |
display: none; | |
} | |
*{ | |
margin:0; | |
padding:0; | |
} | |
body{ | |
font:15px/1.3 'Open Sans', sans-serif; | |
color: #5e5b64; | |
text-align:center; | |
} | |
a, a:visited { | |
outline:none; | |
color:#389dc1; | |
} | |
a:hover{ | |
text-decoration:none; | |
} | |
section, footer, header, aside, nav{ | |
display: block; | |
} | |
/*------------------------- | |
The search input | |
--------------------------*/ | |
.bar{ | |
background-color:#5c9bb7; | |
background-image:-webkit-linear-gradient(top, #5c9bb7, #5392ad); | |
background-image:-moz-linear-gradient(top, #5c9bb7, #5392ad); | |
background-image:linear-gradient(top, #5c9bb7, #5392ad); | |
box-shadow: 0 1px 1px #ccc; | |
border-radius: 2px; | |
width: 400px; | |
padding: 14px; | |
margin: 45px auto 20px; | |
position:relative; | |
} | |
.bar input{ | |
background:#fff no-repeat 13px 13px; | |
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6e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XUHmtBSzpcCGa+5BJTCjEP+0nKWAT8xqe4ArPGEEVC1hHEbs2oBwdXkM7mj/JLZrad437sCGHOfUtcziutuYu2v8XUFF/4f6vMK/YgAH1HxkBYV60AR31gxkBYd6xAeF3VzMCwvzOBpypX8V4yuFRzX2d2gD/l5yjH4fYQEnzkj4fae5rJulF2sMXVrAsaTWttRFu4Osb+1jEDT71/ZveyhouTch2fINQL9hKefKjuYFfuznXWzXMTabyrvfyIV3M4vhXgAEAUMs7K0J9UJAAAAAASUVORK5CYII=); | |
border: none; | |
width: 100%; | |
line-height: 19px; | |
padding: 11px 0; | |
border-radius: 2px; | |
box-shadow: 0 2px 8px #c4c4c4 inset; | |
text-align: left; | |
font-size: 14px; | |
font-family: inherit; | |
color: #738289; | |
font-weight: bold; | |
outline: none; | |
text-indent: 40px; | |
} | |
/*------------------------- | |
List layout | |
--------------------------*/ | |
ul.list{ | |
list-style: none; | |
width: 500px; | |
margin: 0 auto; | |
text-align: left; | |
} | |
ul.list li{ | |
border-bottom: 1px solid #ddd; | |
padding: 10px; | |
overflow: hidden; | |
} | |
ul.list li img{ | |
width:120px; | |
height:120px; | |
float:left; | |
border:none; | |
} | |
ul.list li p{ | |
margin-left: 135px; | |
font-weight: bold; | |
color:#6e7a7f; | |
} | |
/*------------------------- | |
Grid layout | |
--------------------------*/ | |
ul.grid{ | |
list-style: none; | |
width: 570px; | |
margin: 0 auto; | |
text-align: left; | |
} | |
ul.grid li{ | |
padding: 2px; | |
float:left; | |
} | |
ul.grid li img{ | |
width:280px; | |
height:280px; | |
object-fit: cover; | |
display:block; | |
border:none; | |
} | |
ul.grid li p{ | |
font-size: 12px; | |
font-weight: normal; | |
color:#6e7a7f; | |
width:280px; | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript">// Define a custom filter called "searchFor". | |
Vue.filter('searchFor', function (value, searchString) { | |
// The first parameter to this function is the data that is to be filtered. | |
// The second is the string we will be searching for. | |
var result = []; | |
if(!searchString){ | |
return value; | |
} | |
searchString = searchString.trim().toLowerCase(); | |
result = value.filter(function(item){ | |
if(item.title.toLowerCase().indexOf(searchString) !== -1){ | |
return item; | |
} | |
}) | |
// Return an array with the filtered data. | |
return result; | |
}) | |
var demo = new Vue({ | |
el: '#main', | |
data: { | |
searchString: "", | |
// The data model. These items would normally be requested via AJAX, | |
// but are hardcoded here for simplicity. | |
articles: [ | |
{ | |
"title": "What You Need To Know About CSS Variables", | |
"url": "http://tutorialzine.com/2016/03/what-you-need-to-know-about-css-variables/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/03/css-variables.jpg" | |
}, | |
{ | |
"title": "Freebie: 4 Great Looking Pricing Tables", | |
"url": "http://tutorialzine.com/2016/02/freebie-4-great-looking-pricing-tables/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/02/great-looking-pricing-tables.jpg" | |
}, | |
{ | |
"title": "20 Interesting JavaScript and CSS Libraries for February 2016", | |
"url": "http://tutorialzine.com/2016/02/20-interesting-javascript-and-css-libraries-for-february-2016/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/02/interesting-resources-february.jpg" | |
}, | |
{ | |
"title": "Quick Tip: The Easiest Way To Make Responsive Headers", | |
"url": "http://tutorialzine.com/2016/02/quick-tip-easiest-way-to-make-responsive-headers/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/02/quick-tip-responsive-headers.png" | |
}, | |
{ | |
"title": "Learn SQL In 20 Minutes", | |
"url": "http://tutorialzine.com/2016/01/learn-sql-in-20-minutes/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/01/learn-sql-20-minutes.png" | |
}, | |
{ | |
"title": "Creating Your First Desktop App With HTML, JS and Electron", | |
"url": "http://tutorialzine.com/2015/12/creating-your-first-desktop-app-with-html-js-and-electron/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2015/12/creating-your-first-desktop-app-with-electron.png" | |
} | |
] | |
} | |
});</script></body> | |
</html> |
This file contains hidden or 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
/* Hide un-compiled mustache bindings | |
until the Vue instance is ready */ | |
[v-cloak] { | |
display: none; | |
} | |
*{ | |
margin:0; | |
padding:0; | |
} | |
body{ | |
font:15px/1.3 'Open Sans', sans-serif; | |
color: #5e5b64; | |
text-align:center; | |
} | |
a, a:visited { | |
outline:none; | |
color:#389dc1; | |
} | |
a:hover{ | |
text-decoration:none; | |
} | |
section, footer, header, aside, nav{ | |
display: block; | |
} | |
/*------------------------- | |
The search input | |
--------------------------*/ | |
.bar{ | |
background-color:#5c9bb7; | |
background-image:-webkit-linear-gradient(top, #5c9bb7, #5392ad); | |
background-image:-moz-linear-gradient(top, #5c9bb7, #5392ad); | |
background-image:linear-gradient(top, #5c9bb7, #5392ad); | |
box-shadow: 0 1px 1px #ccc; | |
border-radius: 2px; | |
width: 400px; | |
padding: 14px; | |
margin: 45px auto 20px; | |
position:relative; | |
} | |
.bar input{ | |
background:#fff no-repeat 13px 13px; | |
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIge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KjuYFfuznXWzXMTabyrvfyIV3M4vhXgAEAUMs7K0J9UJAAAAAASUVORK5CYII=); | |
border: none; | |
width: 100%; | |
line-height: 19px; | |
padding: 11px 0; | |
border-radius: 2px; | |
box-shadow: 0 2px 8px #c4c4c4 inset; | |
text-align: left; | |
font-size: 14px; | |
font-family: inherit; | |
color: #738289; | |
font-weight: bold; | |
outline: none; | |
text-indent: 40px; | |
} | |
/*------------------------- | |
List layout | |
--------------------------*/ | |
ul.list{ | |
list-style: none; | |
width: 500px; | |
margin: 0 auto; | |
text-align: left; | |
} | |
ul.list li{ | |
border-bottom: 1px solid #ddd; | |
padding: 10px; | |
overflow: hidden; | |
} | |
ul.list li img{ | |
width:120px; | |
height:120px; | |
float:left; | |
border:none; | |
} | |
ul.list li p{ | |
margin-left: 135px; | |
font-weight: bold; | |
color:#6e7a7f; | |
} | |
/*------------------------- | |
Grid layout | |
--------------------------*/ | |
ul.grid{ | |
list-style: none; | |
width: 570px; | |
margin: 0 auto; | |
text-align: left; | |
} | |
ul.grid li{ | |
padding: 2px; | |
float:left; | |
} | |
ul.grid li img{ | |
width:280px; | |
height:280px; | |
object-fit: cover; | |
display:block; | |
border:none; | |
} | |
ul.grid li p{ | |
font-size: 12px; | |
font-weight: normal; | |
color:#6e7a7f; | |
width:280px; | |
} |
This file contains hidden or 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
// Define a custom filter called "searchFor". | |
Vue.filter('searchFor', function (value, searchString) { | |
// The first parameter to this function is the data that is to be filtered. | |
// The second is the string we will be searching for. | |
var result = []; | |
if(!searchString){ | |
return value; | |
} | |
searchString = searchString.trim().toLowerCase(); | |
result = value.filter(function(item){ | |
if(item.title.toLowerCase().indexOf(searchString) !== -1){ | |
return item; | |
} | |
}) | |
// Return an array with the filtered data. | |
return result; | |
}) | |
var demo = new Vue({ | |
el: '#main', | |
data: { | |
searchString: "", | |
// The data model. These items would normally be requested via AJAX, | |
// but are hardcoded here for simplicity. | |
articles: [ | |
{ | |
"title": "What You Need To Know About CSS Variables", | |
"url": "http://tutorialzine.com/2016/03/what-you-need-to-know-about-css-variables/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/03/css-variables.jpg" | |
}, | |
{ | |
"title": "Freebie: 4 Great Looking Pricing Tables", | |
"url": "http://tutorialzine.com/2016/02/freebie-4-great-looking-pricing-tables/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/02/great-looking-pricing-tables.jpg" | |
}, | |
{ | |
"title": "20 Interesting JavaScript and CSS Libraries for February 2016", | |
"url": "http://tutorialzine.com/2016/02/20-interesting-javascript-and-css-libraries-for-february-2016/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/02/interesting-resources-february.jpg" | |
}, | |
{ | |
"title": "Quick Tip: The Easiest Way To Make Responsive Headers", | |
"url": "http://tutorialzine.com/2016/02/quick-tip-easiest-way-to-make-responsive-headers/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/02/quick-tip-responsive-headers.png" | |
}, | |
{ | |
"title": "Learn SQL In 20 Minutes", | |
"url": "http://tutorialzine.com/2016/01/learn-sql-in-20-minutes/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2016/01/learn-sql-20-minutes.png" | |
}, | |
{ | |
"title": "Creating Your First Desktop App With HTML, JS and Electron", | |
"url": "http://tutorialzine.com/2015/12/creating-your-first-desktop-app-with-html-js-and-electron/", | |
"image": "http://cdn.tutorialzine.com/wp-content/uploads/2015/12/creating-your-first-desktop-app-with-electron.png" | |
} | |
] | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment