forms.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Copyright (c) UNA, Inc - https://una.io
  3. * MIT License - https://opensource.org/licenses/MIT
  4. *
  5. * @defgroup BaseGeneral Base classes for modules
  6. * @ingroup UnaModules
  7. *
  8. * @{
  9. */
  10. function bx_base_general_select_thumb(eCheckbox) {
  11. bx_base_general_select_ghost(eCheckbox, 'thumb');
  12. }
  13. function bx_base_general_select_ghost(eCheckbox, sName) {
  14. var eCont = $(eCheckbox).parents('.bx-form-input-files-result');
  15. if (!eCont.length)
  16. return;
  17. eCont.find('.bx-base-general-use-as-' + sName + ' input:checked').each (function () {
  18. if($(this).attr('id') != $(eCheckbox).attr('id'))
  19. $(this).css('border', '1px solid red').attr('checked', false);
  20. });
  21. }
  22. function bx_base_general_delete_ghost (iFileId, sFileUrl, sFileIcon, aEditors, oUploaderInstance) {
  23. if ('undefined' !== typeof(bx_editor_remove_img)) {
  24. bx_editor_remove_img (
  25. aEditors,
  26. ['img[src="' + sFileIcon + '"]', 'img[src="' + sFileUrl + '"]', '#bx-base-general-img-' + iFileId, '.bx-base-general-icon-' + iFileId]
  27. );
  28. }
  29. oUploaderInstance.deleteGhost(iFileId);
  30. }
  31. function bx_base_general_insert_to_post (iFileId, sFileUrl, sEditorId) {
  32. bx_editor_insert_img (sEditorId, 'bx-base-general-img-' + iFileId, sFileUrl, 'bx-base-general-img');
  33. }
  34. /** @} */