מדיה ויקי:Gadget-HotCat.js: הבדלים בין גרסאות בדף

Move the guard. We first must check for actions to be performed!
Localization of OK/Cancel buttons when on the uplaod form.
שורה 50: שורה 50:
   ntde.setAttribute ('id', 'hotcatLabel');
   ntde.setAttribute ('id', 'hotcatLabel');
   var label = null;
   var label = null;
   if (typeof (UploadForm) != 'undefined' &&
   if (typeof (UFUI) != 'undefined' &&
       typeof (UploadForm.getLabel) == 'function') {
       typeof (UFUI.getLabel) == 'function') {
     try {
     try {
       label = UploadForm.getLabel ('wpCategoriesUploadLbl');
       label = UFUI.getLabel ('wpCategoriesUploadLbl');
     } catch (ex) {
     } catch (ex) {
       label = null;
       label = null;
שורה 64: שורה 64:
     // Change the ID to avoid that UploadForm tries to translate it again.
     // Change the ID to avoid that UploadForm tries to translate it again.
     ntde.appendChild (label);
     ntde.appendChild (label);
    ntde.appendChild (document.createTextNode (":"));
   }
   }
   ntde.style.textAlign = "right" ;
   ntde.style.textAlign = "right" ;
שורה 458: שורה 457:
   hotcat_last_v = "" ;
   hotcat_last_v = "" ;
   hotcat_create_new_span ( span_add , "" ) ;
   hotcat_create_new_span ( span_add , "" ) ;
}
function hotcat_button_label (id, default)
{
  var label = null;
  if (hotcat_upload
      && typeof (UFUI) != 'undefined'
      && typeof (UFUI.getLabel) == 'function') {
    try {
      label = UFUI.getLabel (id, true);
      // Extract the plain text. IE doesn't know that Node.TEXT_NODE == 3
      while (label && label.nodeType != 3) label = label.firstChild;
    } catch (ex) {
      label = null;
    }
  }
  if (label == null) return default;
  return label;   
}
}


שורה 511: שורה 528:
   var OK = document.createElement ( "input" ) ;
   var OK = document.createElement ( "input" ) ;
   OK.type = "button" ;
   OK.type = "button" ;
   OK.value = "OK" ;
   OK.value = hotcat_button_label ('wpOkUploadLbl', 'OK') ;
   OK.onclick = function (evt) { hotcat_ok (hotcat_evtkeys (evt) & 1); };
   OK.onclick = function (evt) { hotcat_ok (hotcat_evtkeys (evt) & 1); };


   var cancel = document.createElement ( "input" ) ;
   var cancel = document.createElement ( "input" ) ;
   cancel.type = "button" ;
   cancel.type = "button" ;
   cancel.value = "Cancel" ;
   cancel.value = hotcat_button_label ('wpCancelUploadLbl', 'Cancel') ;
   cancel.onclick = hotcat_cancel ;
   cancel.onclick = hotcat_cancel ;