BVB Source Codes

mongo-express Show document.js Source code

Return Download mongo-express: download document.js Source code - Download mongo-express Source code - Type:.js
  1. import $ from 'jquery';
  2. import CodeMirror from './codeMirrorLoader';
  3.  
  4. const doc = CodeMirror.fromTextArea(document.getElementById('document'), {
  5.   mode: {
  6.     name: 'javascript',
  7.     json: true,
  8.   },
  9.   indentUnit: 4,
  10.   lineNumbers: true,
  11.   autoClearEmptyLines: true,
  12.   matchBrackets: true,
  13.   readOnly: ME_SETTINGS.readOnly,
  14.   theme: ME_SETTINGS.codeMirrorEditorTheme,
  15. });
  16.  
  17. window.onBackClick = function () {
  18.   // "Back" button is clicked
  19.  
  20.   if (doc.isClean()) {
  21.     history.back();
  22.   } else if ($('#discardChanges').length === 0) {
  23.     $('#pageTitle').parent().append(
  24.       '<div id="discardChanges" class="alert alert-warning"><strong>Document has changed! Are you sure you wish to go back?</strong></div>'
  25.     );
  26.     $('.backButton').text('Back & Discard Changes');
  27.   } else {
  28.     history.back();
  29.   }
  30.  
  31.   return false;
  32. };
  33.  
  34. window.onSubmitClick = function () {
  35.   // Save button is clicked
  36.   $('#discardChanges').remove();
  37.  
  38.   $.ajax({
  39.     type: 'POST',
  40.     url: `${ME_SETTINGS.baseHref}checkValid`,
  41.     data: {
  42.       document: doc.getValue(),
  43.     },
  44.   }).done((data) => {
  45.     if (data === 'Valid') {
  46.       $('#documentInvalidJSON').remove();
  47.       $('#documentEditForm').submit();
  48.     } else if ($('#documentInvalidJSON').length === 0) {
  49.       $('#pageTitle').parent().append('<div id="documentInvalidJSON" class="alert alert-danger"><strong>Invalid JSON</strong></div>');
  50.     }
  51.   });
  52.   return false;
  53. };
  54.  
downloaddocument.js Source code - Download mongo-express Source code
Related Source Codes/Software:
XCL-Charts - Android charting libraries (XCL-Charts is a free c... 2017-05-17
scrollMonitor - A simple and fast API to monitor elements as you s... 2017-05-16
XCDYouTubeKit - YouTube video player for iOS, tvOS and macOS 2017-05-16
rails-erd - Generate Entity-Relationship Diagrams for Rails ap... 2017-05-16
np - A better `npm publish` 2017-05-16
kaminari - A Scope & Engine based, clean, powerful, custo... 2017-06-04
python-fire - Python Fire is a library for automatically generat... 2017-06-04
Dapper - Dapper - a simple object mapper for .Net 2017-06-05
pkg - Package your Node.js project into an executable ... 2017-06-05
packer - Packer is a tool for creating identical machine im... 2017-06-05
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top