Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>Demo</title>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
- <link type="text/css" rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.22.custom.css" />
- <script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"> </script>
- <script type="text/javascript" src="js/dialog.js"></script>
- <script type="text/javascript">
- $(document).ready(function () {
- $("#imgWindows").dialog({
- autoOpen: false,
- resizable: true,
- modal: true,
- title: "Image Info",
- height: 500,
- width: 650
- });
- });
- function autoResize(id) {
- var newheight;
- var newwidth;
- if (document.getElementById) {
- newheight = document.getElementById(id).contentWindow.document.body.scrollHeight;
- newwidth = document.getElementById(id).contentWindow.document.body.scrollWidth;
- }
- document.getElementById(id).height = (newheight) + "px";
- document.getElementById(id).width = (newwidth) + "px";
- }
- var num;
- function clearImages() {
- document.getElementById("pics").innerHTML = "";
- }
- function openDialog(stringURL) {
- $("#imgWindows").attr("src", stringURL);
- $("#imgWindows").dialog("open");
- }
- function getImages(hashtag) {
- clearImages();
- $(function () {
- $.ajax({
- type: "GET",
- dataType: "jsonp",
- cache: false,
- url: "https://api.instagram.com/v1/tags/" + hashtag + "/media/recent?access_token=1082107741.1fb234f.69dad482ae604481846a3307a774a674&count=100",
- success: function (data) {
- num = data.data.length;
- for (var i = 0; i < data.data.length; i++) {
- var img = data.data[i].images.standard_resolution.url;
- var username = data.data[i].user.username;
- var fullname = data.data[i].user.full_name;
- var profilepic = data.data[i].user.profile_picture;
- var imglink = data.data[i].link;
- $("#pics").append("<a href='Image.html?username=" + username + "&fullname=" + fullname + "&imglink=" + imglink + "&profilepic=" + profilepic + "&img=" + img + "' onclick='return false;' class='imageSearch' style='text-decoration: none' > <img onload='$(this).fadeIn();' style='display:none;' src='" + data.data[i].images.thumbnail.url + "'></img></a> ");
- } //End for loop
- $("a.imageSearch").click(function () {
- openDialog($(this).attr("href"));
- });
- }
- });
- });
- }
- </script>
- </head>
- <body>
- <input id="txtHasgtag" type="text" /><br />
- <br />
- <input id="Button1" onclick="getImages(txtHasgtag.value);$('#imgWindows').close(); $('div').fadeIn(1000); return false;" type="button" value="Search" />
- <br />
- <br />
- <div id="pics" />
- <iframe style="display:none" width="100%" height="200px" id="imgWindows" marginheight="0" frameborder="0" onLoad="autoResize('imgWindows');">
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment