Ticket #2961: ajax_request_thing.diff
File ajax_request_thing.diff, 3.2 KB (added by , 17 years ago) |
---|
-
includes/ajax_utils.php
1 <SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT"> 2 <!--Hide script from old browsers 3 4 var pending_ajax_requests = 0; 5 6 function ajax_add_request() { 7 pending_ajax_requests +=1; 8 get_element('ajax_num_requests').innerHTML = pending_ajax_requests; 9 remove_class('ajax_working', 'hidden'); 10 } 11 12 function ajax_remove_request() { 13 pending_ajax_requests -=1; 14 get_element('ajax_num_requests').innerHTML = pending_ajax_requests; 15 if (pending_ajax_requests == 0) 16 add_class('ajax_working', 'hidden'); 17 } 18 19 //Stop hiding script from old browsers --> 20 </script> 21 22 <div id="ajax_working" class="hidden"> 23 <span id="ajax_num_requests">0</span> requests pending. 24 </div> 25 No newline at end of file -
modules/tv/tmpl/default/recorded.php
121 121 // Do the actual deletion 122 122 if (programs_shown == 1) 123 123 location.href = url; 124 else 124 else { 125 ajax_add_request(); 125 126 submit_url(url, http_success, http_failure, id, file); 127 } 126 128 // Debug statements - uncomment to verify that the right file is being deleted 127 129 //alert('row number ' + id + ' belonged to section ' + section + ' which now has ' + rowcount[section] + ' elements'); 128 130 //alert('just deleted an episode of "' + title + '" which now has ' + episode_count + ' episodes left'); … … 189 191 $('diskfree').innerHTML = nice_filesize(<?php echo disk_size ?> - diskused); 190 192 // Eventually, we should perform the removal-from-the-list here instead 191 193 // of in confirm_delete() 194 ajax_remove_request(); 192 195 } 193 196 194 197 function http_failure(err, errstr, args) { 195 198 var file = args[0]; 196 199 alert("Can't delete "+file.title+': '+file.subtitle+".\nHTTP Error: " + errstr + ' (' + err + ')'); 200 ajax_remove_request(); 197 201 } 198 202 199 203 // --> -
modules/_shared/tmpl/default/footer.php
19 19 echo $note; 20 20 } 21 21 } 22 23 // Add in the ajax utils code 24 require_once 'includes/ajax_utils.php'; 22 25 ?> 23 26 24 27 </body> -
skins/default/style.css
202 202 .clearfix {display: block;} 203 203 /* End hide from IE-mac */ 204 204 205 /* Ajax little popup request thing style */ 206 #ajax_working { 207 position: fixed; 208 background-color: green; 209 bottom: 0px; 210 left: 1em; 211 padding: 1em; 212 width: 10em; 213 text-align: center; 214 } 215