Created
April 19, 2016 17:49
-
-
Save ng/413ab25d5d92c9fb5312220445c20b69 to your computer and use it in GitHub Desktop.
This file contains 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> | |
<head> | |
<title>CL Queries</title> | |
<style> | |
#container { | |
display: flex; | |
} | |
iframe {; | |
height: 100%; | |
width: 100%; | |
} | |
.iframe-wrapper { | |
flex: 1; | |
margin: 8px; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="container"></div> | |
</body> | |
<script> | |
(function(){ | |
var query = "race trailer living"; | |
var citiesArray = ["la", "lasvegas", "portland", "seattle"]; | |
var $container = document.querySelector("#container"); | |
citiesArray.forEach(function(city) { | |
var wrapper = document.createElement("div"); | |
var h1 = document.createElement("h1"); | |
var text = document.createTextNode(city); | |
var iframe = document.createElement("iframe"); | |
iframe.src = "https://" + city + ".craigslist.org/search/sss?query=" + escape(query); | |
wrapper.className = "iframe-wrapper"; | |
h1.appendChild(text); | |
wrapper.appendChild(h1); | |
wrapper.appendChild(iframe); | |
$container.appendChild(wrapper); | |
}); | |
})(); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment