video_filter_dialog.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * @file video_filter ckeditor dialog helper
  3. */
  4. var video_filter_dialog = {};
  5. (function ($) {
  6. video_filter_dialog = {
  7. init : function() {
  8. //Get CKEDITOR
  9. CKEDITOR = dialogArguments.opener.CKEDITOR;
  10. //Get the current instance name
  11. var name = dialogArguments.editorname;
  12. //Get the editor instance
  13. editor = CKEDITOR.instances[name];
  14. },
  15. insert : function() {
  16. // Get the params from the form
  17. var params = this._getParams();
  18. //If no file url, just close this window
  19. if(params.file_url == "") {
  20. window.close();
  21. }
  22. else {
  23. CKEDITOR.tools.callFunction(editor._.video_filterFnNum, params, editor);
  24. window.close();
  25. }
  26. },
  27. _getParams : function () {
  28. var params = {};
  29. $('fieldset:first-child input, fieldset:first-child select').each(function() {
  30. if($(this).attr('type') == "checkbox") {
  31. if($(this).is(':checked')) {
  32. params[$(this).attr('name')] = $(this).val();
  33. }
  34. }
  35. else {
  36. if($(this).val() != "" && $(this).val() != "none") {
  37. params[$(this).attr('name')] = $(this).val();
  38. }
  39. }
  40. });
  41. return params;
  42. }
  43. };
  44. $(document).ready(function() {
  45. var CKEDITOR, editor;
  46. video_filter_dialog.init();
  47. $('#edit-insert').click(function() {
  48. video_filter_dialog.insert();
  49. return false;
  50. });
  51. $('#edit-cancel').click(function() {
  52. window.close();
  53. return false;
  54. });
  55. });
  56. })(jQuery);