Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. $(function() {
  2.  
  3. CKEDITOR.on('dialogDefinition', function(event) {
  4. var editor = event.editor;
  5. var dialogDefinition = event.data.definition;
  6. var tabCount = dialogDefinition.contents.length;
  7. for (var i = 0; i < tabCount; i++) { // cycle to replace the click of button "View on the server"
  8.  
  9. if (!dialogDefinition.contents[i]) {
  10. continue;
  11. }
  12.  
  13. var browseButton = dialogDefinition.contents[i].get('browse');
  14.  
  15. if (browseButton !== null) {
  16. browseButton.hidden = false;
  17. browseButton.onClick = function(dialog, i) {
  18.  
  19. var dialogName = CKEDITOR.dialog.getCurrent()._.name;
  20.  
  21. var elfNode = $('<div \>').css({
  22. "z-index": "100000"
  23. });
  24. elfNode.dialogelfinder({
  25. title: '',
  26. url: '/admin/elfinder/connector',
  27. useBrowserHistory: false,
  28. resizable: false,
  29. getFileCallback: function(file) {
  30. var url = file.url;
  31. var dialog = CKEDITOR.dialog.getCurrent();
  32. if (dialogName == 'image') {
  33. var urlObj = 'txtUrl'
  34. } else if (dialogName == 'flash') {
  35. var urlObj = 'src'
  36. } else if (dialogName == 'files' || dialogName == 'link') {
  37. var urlObj = 'url'
  38. } else {
  39. return;
  40. }
  41. dialog.setValueOf(dialog._.currentTabId, urlObj, url);
  42. elfNode.dialogelfinder('close');
  43. }
  44. });
  45. }
  46. }
  47. }
  48. })
  49. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement