example.ejs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <%- partial('partials/sidebar', { type: page.type, index: page.index }) %>
  2. <div class="Content js-Content <%- page.type ? page.type + ' with-sidebar' : '' %>">
  3. <h1><%- page.title %> Example</h1>
  4. <%- page.content %>
  5. <p>Please see <a href="/uppy/docs/">documentation</a> for details.</p>
  6. <hr>
  7. <p>Hey there stranger! Uppy <img src="/uppy/images/emojis/dog.png" width="14" align="absmiddle">
  8. is actively developed and the example section
  9. is our playground. Things might not work, but we're working hard to improve.</p>
  10. <p>We're on a monthly release cycle and our latest version is
  11. <a href="https://github.com/transloadit/uppy/blob/main/CHANGELOG.md#<%- theme.uppy_version_anchor %>">v<%- theme.uppy_version %></a>,
  12. but the example pages reflect the latest work in our main branch. Here's
  13. <a href="https://github.com/transloadit/uppy/compare/uppy@<%- theme.uppy_version %>...main">what changed in main since v<%- theme.uppy_version %></a>
  14. in terms of commits, while the CHANGELOG
  15. provides a higher level view of the things planned for our
  16. <a href="https://github.com/transloadit/uppy/blob/main/CHANGELOG.md#next">next release</a>.</p>
  17. <!-- Add textarea already so it's available immediately for logging.
  18. It is later made visible, and moved into the #console-wrapper to position it in layout how
  19. you see fit. -->
  20. <blockquote>Files from the examples are uploaded to our test servers and deleted every 24-72 hours.</blockquote>
  21. <textarea id="console-log" class="Console"></textarea>
  22. <script>
  23. function customLog (log, container) {
  24. return function () {
  25. var text = [];
  26. // loop through `arguments`, because console.log accepts multiple
  27. var args = Array.prototype.slice.call(arguments);
  28. args.forEach(function (arg) {
  29. if (arg !== (arg + '')) {
  30. // try/catch to prevent TypeError: cyclic object value
  31. try {
  32. arg = JSON.stringify(arg);
  33. } catch (err) {}
  34. }
  35. text.push(arg);
  36. })
  37. text = text.join(' ');
  38. log(text);
  39. container.value += text + '\n';
  40. container.scrollTop = container.scrollHeight;
  41. };
  42. }
  43. // IE 10 doesn’t support console.debug
  44. var consoleDebug = console.debug || console.log
  45. console.log = customLog(console.log.bind(console), document.getElementById("console-log"));
  46. console.debug = customLog(consoleDebug.bind(console), document.getElementById("console-log"));
  47. console.warn = customLog(console.warn.bind(console), document.getElementById("console-log"));
  48. console.error = customLog(console.error.bind(console), document.getElementById("console-log"));
  49. </script>
  50. <script>
  51. // #console-log textarea is declared earlier so it's available immediately for logging.
  52. // Here it is made visible, and moved into the #console-wrapper, so you can position it in the layout how
  53. // you see fit.
  54. document.getElementById('console-wrapper').appendChild(document.getElementById('console-log'));
  55. document.getElementById('console-log').style.display = 'block';
  56. </script>
  57. <div class="footer">Caught a mistake or want to contribute to the documentation?
  58. <a href="https://github.com/transloadit/uppy/blob/main/website/src/<%- page.source %>" rel="noreferrer noopener" target="_blank">Edit/fork this page directly on Github</a>!
  59. </div>
  60. </div>