Index: trunk/tools/wp-photocommons/search.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -require_once '../../wp-load.php'; |
| 3 | +require_once '../../../wp-load.php'; |
4 | 4 | |
5 | 5 | $path = dirname( $_SERVER['PHP_SELF'] ); |
6 | 6 | // Standalone is used to debug/test this page directly, |
Index: trunk/tools/wp-photocommons/js/search.js |
— | — | @@ -1,23 +1,12 @@ |
2 | | -// usage: log('inside coolFunc',this,arguments); |
3 | | -// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ |
4 | | -window.log = function(){ |
5 | | - log.history = log.history || []; // store logs to an array for reference |
6 | | - log.history.push(arguments); |
7 | | - if(this.console){ |
8 | | - console.log( Array.prototype.slice.call(arguments) ); |
9 | | - } |
10 | | -}; |
11 | | - |
12 | 2 | if ( !window.PhotoCommons ) { |
13 | 3 | window.PhotoCommons = {}; |
14 | 4 | } |
15 | 5 | |
16 | 6 | (function($){ |
17 | | - |
18 | 7 | $.extend( PhotoCommons, { |
19 | | - |
20 | 8 | getQueryUrl: function( type, args ) { |
21 | 9 | var queries = { |
| 10 | + // Used for the suggestions |
22 | 11 | 'pagesearch' : function(q) { |
23 | 12 | return { |
24 | 13 | 'action' : 'opensearch', |
— | — | @@ -56,7 +45,7 @@ |
57 | 46 | |
58 | 47 | return PhotoCommons.makeUrl(queries[type](args)); |
59 | 48 | }, |
60 | | - |
| 49 | + |
61 | 50 | makeUrl: function( args ) { |
62 | 51 | // default arguments |
63 | 52 | args = $.extend({ |
— | — | @@ -84,9 +73,9 @@ |
85 | 74 | } |
86 | 75 | return url; |
87 | 76 | }, |
88 | | - |
| 77 | + |
89 | 78 | init: function() { |
90 | | - |
| 79 | + |
91 | 80 | /* jQuery suggestions */ |
92 | 81 | $( '#wp-photocommons-search' ).suggestions( { |
93 | 82 | fetch: function( query ) { |
— | — | @@ -110,9 +99,9 @@ |
111 | 100 | }); |
112 | 101 | |
113 | 102 | $( '#wp-photocommons-images' ).empty(); |
114 | | - $( '#wp-photocommons-loading' ).show(); |
| 103 | + $( '#wp-photocommons-loading' ).show(); |
115 | 104 | $.getJSON( url, function( data ) { |
116 | | - |
| 105 | + |
117 | 106 | if ( !data.query.pageids.length ) { |
118 | 107 | $( '#wp-photocommons-images' ).html( 'No images found :(' ); |
119 | 108 | } else { |
— | — | @@ -127,17 +116,17 @@ |
128 | 117 | 'style': "background-image:url('" + img.imageinfo[0].thumburl + "');", |
129 | 118 | 'data-filename': pagetitle |
130 | 119 | }).appendTo('#wp-photocommons-images'); |
131 | | - |
| 120 | + |
132 | 121 | } |
133 | 122 | }); |
134 | | - |
| 123 | + |
135 | 124 | } |
136 | | - |
| 125 | + |
137 | 126 | $( '#wp-photocommons-loading' ).hide(); |
138 | 127 | }); |
139 | 128 | } |
140 | 129 | } |
141 | | - |
| 130 | + |
142 | 131 | } ); |
143 | 132 | } |
144 | 133 | }); |