Index: trunk/tools/wp-photocommons/search.js |
— | — | @@ -1,7 +1,9 @@ |
2 | 2 | // Debug |
3 | 3 | window.log = (console && console.log) ? console.log : function(){}; |
4 | 4 | |
5 | | -if (!window.Photocommons) window.Photocommons = {}; |
| 5 | +if ( !window.Photocommons ) { |
| 6 | + window.Photocommons = {}; |
| 7 | +} |
6 | 8 | |
7 | 9 | $.extend( Photocommons, { |
8 | 10 | |
— | — | @@ -67,10 +69,10 @@ |
68 | 70 | }, |
69 | 71 | init: function() { |
70 | 72 | |
71 | | - $('#search').autocomplete({ |
| 73 | + $('#wp-photocommons-search').autocomplete({ |
72 | 74 | source : function(request, response) { |
73 | 75 | var url = Photocommons.getQueryUrl('pagesearch', { |
74 | | - 'search' : $('#search').val() |
| 76 | + 'search' : $('#wp-photocommons-search').val() |
75 | 77 | }); |
76 | 78 | |
77 | 79 | $.getJSON(url, function(data) { |
— | — | @@ -79,8 +81,8 @@ |
80 | 82 | }, |
81 | 83 | |
82 | 84 | select : function(event, ui) { |
83 | | - $('#images').empty(); |
84 | | - $('#loading').show(); |
| 85 | + $('#wp-photocommons-images').empty(); |
| 86 | + $('#wp-photocommons-loading').show(); |
85 | 87 | |
86 | 88 | var url = Photocommons.getQueryUrl('pageimages', { |
87 | 89 | 'title' : ui.item.value |
— | — | @@ -91,7 +93,7 @@ |
92 | 94 | query = data.query.pages[pageid].images; |
93 | 95 | |
94 | 96 | if (!query) { |
95 | | - $('#images').html('No images found :('); |
| 97 | + $('#wp-photocommons-images').html('No images found :('); |
96 | 98 | } |
97 | 99 | |
98 | 100 | $.each(query, function() { |
— | — | @@ -103,11 +105,11 @@ |
104 | 106 | $.getJSON(url, function(data) { |
105 | 107 | var pageid = data.query.pageids[0], |
106 | 108 | src = data.query.pages[pageid].imageinfo[0].thumburl; |
107 | | - $('#images').append('<img src="' + src + '" style="display:none;"/>').find('img').fadeIn(); |
| 109 | + $('#wp-photocommons-images').append('<img src="' + src + '" style="display:none;"/>').find('img').fadeIn(); |
108 | 110 | }); |
109 | 111 | }); |
110 | 112 | |
111 | | - $('#loading').hide(); |
| 113 | + $('#wp-photocommons-loading').hide(); |
112 | 114 | }); |
113 | 115 | } |
114 | 116 | }); |
Index: trunk/tools/wp-photocommons/search.php |
— | — | @@ -2,15 +2,20 @@ |
3 | 3 | <html> |
4 | 4 | <head> |
5 | 5 | <meta charset="utf-8" /> |
| 6 | + <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> |
| 7 | + <script src="js/jquery-ui-1.8.5.custom.min.js"></script> |
| 8 | + <script src="search.js"></script> |
6 | 9 | <link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.5.custom.css" /> |
7 | 10 | </head> |
8 | 11 | <body> |
9 | | -<input type="search" id="search" /> |
10 | | -<ul id="results"></ul> |
11 | | -<img src="img/loading.gif" style="display:none;" id="loading" /> |
12 | | -<div id="images"></div> |
13 | | -<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> |
14 | | -<script src="js/jquery-ui-1.8.5.custom.min.js"></script> |
15 | | -<script src="search.js"></script> |
| 12 | + |
| 13 | + <input type="search" id="wp-photocommons-search" /> |
| 14 | + |
| 15 | + <ul id="wp-photocommons-results"></ul> |
| 16 | + |
| 17 | + <img src="img/loading.gif" style="display:none;" id="wp-photocommons-loading" /> |
| 18 | + |
| 19 | + <div id="wp-photocommons-images"></div> |
| 20 | + |
16 | 21 | </body> |
17 | 22 | </html> |
\ No newline at end of file |