plugins/gallery/tagging.js
changeset 25 d9f37d2ea2cf
parent 24 7f3bd3030ae9
child 35 1dd30d7bf29f
equal deleted inserted replaced
24:7f3bd3030ae9 25:d9f37d2ea2cf
   359       }
   359       }
   360     }
   360     }
   361   }
   361   }
   362 }
   362 }
   363 
   363 
   364 var snapr_tags_onload = function()
   364 // Don't fire the tag init until JS init *and* image are finished.
   365 {
   365 // Thanks to pmccullough for pointing out this race condition.
       
   366 var snapr_lock_onload_js = true;
       
   367 var snapr_lock_onload_img = true;
       
   368 
       
   369 var snapr_tags_onload_real = function()
       
   370 {
       
   371   // make sure we aren't waiting...
       
   372   if ( snapr_lock_onload_img || snapr_lock_onload_js )
       
   373     return false;
       
   374   
   366   // add the new box
   375   // add the new box
   367   var parent_obj = document.getElementById('snapr_preview_img').parentNode;
   376   var parent_obj = document.getElementById('snapr_preview_img').parentNode;
   368   var id = parent_obj.getAttribute('snapr:imgid');
   377   var id = parent_obj.getAttribute('snapr:imgid');
   369   if ( !id )
   378   if ( !id )
   370     return false;
   379     return false;
   371   ajaxPost(makeUrlNS('Gallery', id), 'ajax=true&act=get_tags', snapr_process_ajax_tag_packet);
   380   ajaxPost(makeUrlNS('Gallery', id), 'ajax=true&act=get_tags', snapr_process_ajax_tag_packet);
   372 }
   381 }
   373 
   382 
       
   383 var snapr_tags_onload = function()
       
   384 {
       
   385   snapr_lock_onload_js = false;
       
   386   snapr_tags_onload_real();
       
   387 }
       
   388 
   374 addOnloadHook(snapr_tags_onload);
   389 addOnloadHook(snapr_tags_onload);
   375 
   390