Guest User

Untitled

a guest
Feb 16th, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Demo</title>
  6. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  7. <link type="text/css" rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.22.custom.css" />
  8. <script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"> </script>
  9. <script type="text/javascript" src="js/dialog.js"></script>
  10. <script type="text/javascript">
  11. $(document).ready(function () {
  12. $("#imgWindows").dialog({
  13. autoOpen: false,
  14. resizable: true,
  15. modal: true,
  16. title: "Image Info",
  17. height: 500,
  18. width: 650
  19. });
  20. });
  21.  
  22. function autoResize(id) {
  23. var newheight;
  24. var newwidth;
  25.  
  26. if (document.getElementById) {
  27. newheight = document.getElementById(id).contentWindow.document.body.scrollHeight;
  28. newwidth = document.getElementById(id).contentWindow.document.body.scrollWidth;
  29. }
  30.  
  31. document.getElementById(id).height = (newheight) + "px";
  32. document.getElementById(id).width = (newwidth) + "px";
  33. }
  34.  
  35. var num;
  36. function clearImages() {
  37. document.getElementById("pics").innerHTML = "";
  38. }
  39.  
  40. function openDialog(stringURL) {
  41. $("#imgWindows").attr("src", stringURL);
  42. $("#imgWindows").dialog("open");
  43. }
  44.  
  45. function getImages(hashtag) {
  46. clearImages();
  47. $(function () {
  48. $.ajax({
  49. type: "GET",
  50. dataType: "jsonp",
  51. cache: false,
  52. url: "https://api.instagram.com/v1/tags/" + hashtag + "/media/recent?access_token=1082107741.1fb234f.69dad482ae604481846a3307a774a674&count=100",
  53. success: function (data) {
  54. num = data.data.length;
  55. for (var i = 0; i < data.data.length; i++) {
  56. var img = data.data[i].images.standard_resolution.url;
  57. var username = data.data[i].user.username;
  58. var fullname = data.data[i].user.full_name;
  59. var profilepic = data.data[i].user.profile_picture;
  60. var imglink = data.data[i].link;
  61. $("#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>&nbsp;");
  62. } //End for loop
  63. $("a.imageSearch").click(function () {
  64. openDialog($(this).attr("href"));
  65. });
  66. }
  67. });
  68. });
  69.  
  70.  
  71. }
  72.  
  73. </script>
  74. </head>
  75. <body>
  76. <input id="txtHasgtag" type="text" /><br />
  77. <br />
  78. <input id="Button1" onclick="getImages(txtHasgtag.value);$('#imgWindows').close(); $('div').fadeIn(1000); return false;" type="button" value="Search" />
  79. <br />
  80. <br />
  81. <div id="pics" />
  82.  
  83. <iframe style="display:none" width="100%" height="200px" id="imgWindows" marginheight="0" frameborder="0" onLoad="autoResize('imgWindows');">
  84. </body>
  85. </html>
Advertisement
Add Comment
Please, Sign In to add comment