Permalink
Browse files

Moved examples to share/share-examples

  • Loading branch information...
1 parent fcb4c54 commit 442b2a7791212a49831f41f0e3d9e1e5a9f27bc6 @josephg committed Sep 3, 2013
Showing with 0 additions and 27,012 deletions.
  1. +0 −86 bin/exampleserver
  2. +0 −50 examples/README.md
  3. +0 −8 examples/_static/README.md
  4. +0 −20 examples/_static/index.coffee
  5. +0 −11 examples/_static/template.html.mu
  6. +0 −48 examples/_wiki/index.coffee
  7. +0 −49 examples/_wiki/style.css
  8. +0 −59 examples/_wiki/wiki.html.mu
  9. +0 −78 examples/ace/index.html
  10. +0 −44 examples/ace/style.css
  11. +0 −31 examples/clobber-ace.html
  12. +0 −58 examples/cm/index.html
  13. +0 −35 examples/cm/style.css
  14. +0 −70 examples/code.html
  15. +0 −153 examples/demos.html
  16. +0 −31 examples/hello-ace.html
  17. +0 −69 examples/hello-etherpad.html
  18. +0 −12 examples/hello-node.js
  19. +0 −28 examples/hello-readonly.html
  20. +0 −21 examples/hello-stream.js
  21. +0 −32 examples/hello-tp2.html
  22. +0 −568 examples/hex.html
  23. +0 −308 examples/index.html
  24. +0 −17,567 examples/lib/ace/ace-uncompressed.js
  25. +0 −1 examples/lib/ace/ace.js
  26. +0 −1 examples/lib/ace/keybinding-emacs.js
  27. +0 −1 examples/lib/ace/keybinding-vim.js
  28. +0 −1 examples/lib/ace/mode-c_cpp.js
  29. +0 −1 examples/lib/ace/mode-clojure.js
  30. +0 −1 examples/lib/ace/mode-coffee.js
  31. +0 −1 examples/lib/ace/mode-coldfusion.js
  32. +0 −1 examples/lib/ace/mode-csharp.js
  33. +0 −1 examples/lib/ace/mode-css.js
  34. +0 −1 examples/lib/ace/mode-groovy.js
  35. +0 −1 examples/lib/ace/mode-html.js
  36. +0 −1 examples/lib/ace/mode-java.js
  37. +0 −1 examples/lib/ace/mode-javascript.js
  38. +0 −1 examples/lib/ace/mode-json.js
  39. +0 −1 examples/lib/ace/mode-latex.js
  40. +0 −1 examples/lib/ace/mode-lua.js
  41. +0 −1 examples/lib/ace/mode-markdown.js
  42. +0 −1 examples/lib/ace/mode-ocaml.js
  43. +0 −1 examples/lib/ace/mode-perl.js
  44. +0 −1 examples/lib/ace/mode-php.js
  45. +0 −1 examples/lib/ace/mode-powershell.js
  46. +0 −1 examples/lib/ace/mode-python.js
  47. +0 −1 examples/lib/ace/mode-ruby.js
  48. +0 −1 examples/lib/ace/mode-scad.js
  49. +0 −1 examples/lib/ace/mode-scala.js
  50. +0 −1 examples/lib/ace/mode-scss.js
  51. +0 −1 examples/lib/ace/mode-sql.js
  52. +0 −1 examples/lib/ace/mode-svg.js
  53. +0 −1 examples/lib/ace/mode-textile.js
  54. +0 −1 examples/lib/ace/mode-xml.js
  55. +0 −1 examples/lib/ace/theme-clouds.js
  56. +0 −1 examples/lib/ace/theme-clouds_midnight.js
  57. +0 −1 examples/lib/ace/theme-cobalt.js
  58. +0 −1 examples/lib/ace/theme-crimson_editor.js
  59. +0 −1 examples/lib/ace/theme-dawn.js
  60. +0 −1 examples/lib/ace/theme-eclipse.js
  61. +0 −1 examples/lib/ace/theme-idle_fingers.js
  62. +0 −1 examples/lib/ace/theme-kr_theme.js
  63. +0 −1 examples/lib/ace/theme-merbivore.js
  64. +0 −1 examples/lib/ace/theme-merbivore_soft.js
  65. +0 −1 examples/lib/ace/theme-mono_industrial.js
  66. +0 −1 examples/lib/ace/theme-monokai.js
  67. +0 −1 examples/lib/ace/theme-pastel_on_dark.js
  68. +0 −1 examples/lib/ace/theme-solarized_dark.js
  69. +0 −1 examples/lib/ace/theme-solarized_light.js
  70. +0 −1 examples/lib/ace/theme-textmate.js
  71. +0 −1 examples/lib/ace/theme-tomorrow.js
  72. +0 −1 examples/lib/ace/theme-tomorrow_night.js
  73. +0 −1 examples/lib/ace/theme-tomorrow_night_blue.js
  74. +0 −1 examples/lib/ace/theme-tomorrow_night_bright.js
  75. +0 −1 examples/lib/ace/theme-tomorrow_night_eighties.js
  76. +0 −1 examples/lib/ace/theme-twilight.js
  77. +0 −1 examples/lib/ace/theme-vibrant_ink.js
  78. +0 −1 examples/lib/ace/worker-coffee.js
  79. +0 −1 examples/lib/ace/worker-css.js
  80. +0 −1 examples/lib/ace/worker-javascript.js
  81. +0 −356 examples/lib/bootstrap.min.css
  82. +0 −110 examples/lib/cm/lib/codemirror.css
  83. +0 −2,889 examples/lib/cm/lib/codemirror.js
  84. +0 −23 examples/lib/cm/lib/util/dialog.css
  85. +0 −63 examples/lib/cm/lib/util/dialog.js
  86. +0 −186 examples/lib/cm/lib/util/foldcode.js
  87. +0 −294 examples/lib/cm/lib/util/formatting.js
  88. +0 −134 examples/lib/cm/lib/util/javascript-hint.js
  89. +0 −44 examples/lib/cm/lib/util/match-highlighter.js
  90. +0 −51 examples/lib/cm/lib/util/overlay.js
  91. +0 −49 examples/lib/cm/lib/util/runmode.js
  92. +0 −114 examples/lib/cm/lib/util/search.js
  93. +0 −117 examples/lib/cm/lib/util/searchcursor.js
  94. +0 −16 examples/lib/cm/lib/util/simple-hint.css
  95. +0 −66 examples/lib/cm/lib/util/simple-hint.js
  96. +0 −341 examples/lib/cm/mode/coffeescript/coffeescript.js
  97. +0 −360 examples/lib/cm/mode/javascript/javascript.js
  98. +0 −18 examples/lib/cm/theme/cobalt.css
  99. +0 −25 examples/lib/cm/theme/eclipse.css
  100. +0 −10 examples/lib/cm/theme/elegant.css
  101. +0 −28 examples/lib/cm/theme/monokai.css
  102. +0 −9 examples/lib/cm/theme/neat.css
  103. +0 −21 examples/lib/cm/theme/night.css
  104. +0 −21 examples/lib/cm/theme/rubyblue.css
  105. +0 −307 examples/lib/jquery.quicksand.js
  106. +0 −18 examples/lib/markdown/preview.js
  107. +0 −1,391 examples/lib/markdown/showdown.js
  108. +0 −1 examples/lib/prettify.css
  109. +0 −28 examples/lib/prettify.js
  110. +0 −51 examples/pad/pad.html
  111. +0 −71 examples/peep-peep/css/peep-peep.css
  112. +0 −49 examples/peep-peep/js/peep-peep.js
  113. +0 −35 examples/peep-peep/peep-peep.html
  114. +0 −37 examples/readonly/html.html
  115. +0 −43 examples/readonly/markdown.html
  116. +0 −36 examples/sharefile.coffee
  117. +0 −53 examples/shout.html
  118. +0 −17 examples/style.css
  119. +0 −38 examples/textarea.html
View
@@ -1,86 +0,0 @@
-#!/usr/bin/env node
-
-// This is a simple example sharejs server which hosts the sharejs
-// examples in examples/.
-//
-// It demonstrates a few techniques to get different application behaviour.
-
-require('coffee-script');
-var express = require('express'),
- sharejs = require('../src'),
- hat = require('hat').rack(32, 36);
-
-var argv = require('optimist').
- usage("Usage: $0 [-p portnum]").
- default('p', 8000).
- alias('p', 'port').
- argv;
-
-var server = express();
-server.use(express.static(__dirname + '/../examples'));
-
-var options = {
- db: {type: 'none'},
- browserChannel: {cors: '*'},
- auth: function(client, action) {
- // This auth handler rejects any ops bound for docs starting with 'readonly'.
- if (action.name === 'submit op' && action.docName.match(/^readonly/)) {
- action.reject();
- } else {
- action.accept();
- }
- }
-};
-
-// Lets try and enable redis persistance if redis is installed...
-try {
- require('redis');
- options.db = {type: 'redis'};
-} catch (e) {}
-
-console.log("ShareJS example server v" + sharejs.version);
-console.log("Options: ", options);
-
-var port = argv.p;
-
-// Attach the sharejs REST and Socket.io interfaces to the server
-sharejs.server.attach(server, options);
-
-var renderer = require('../examples/_static');
-server.get('/static/:docName', function(req, res, next) {
- var docName;
- docName = req.params.docName;
- renderer(docName, server.model, res, next);
-});
-
-var wiki = require('../examples/_wiki');
-server.get('/wiki/?', function(req, res, next) {
- res.writeHead(301, {location: '/wiki/Main'});
- res.end();
-});
-server.get('/wiki/:docName', function(req, res, next) {
- var docName;
- docName = req.params.docName;
- wiki(docName, server.model, res, next);
-});
-
-server.get('/pad/?', function(req, res, next) {
- var docName;
- docName = hat();
- res.writeHead(303, {location: '/pad/pad.html#' + docName});
- res.write('');
- res.end();
-});
-
-server.get('/?', function(req, res, next) {
- res.writeHead(302, {location: '/index.html'});
- res.end();
-});
-server.listen(port);
-console.log("Demos running at http://localhost:" + port);
-
-process.title = 'sharejs'
-process.on('uncaughtException', function (err) {
- console.error('An error has occurred. Please file a ticket here: https://github.com/josephg/ShareJS/issues');
- console.error('Version ' + sharejs.version + ': ' + err.stack);
-});
View
@@ -1,50 +0,0 @@
-This is a bunch of little demo apps using Share.js.
-
-Launch the example sharejs server with
-
- % bin/exampleserver
-
-
-readonly
---------
-
-Two little demos of live viewers for sharejs documents.
-
-Browse to http://localhost:8000/readonly/html.html
-and http://localhost:8000/readonly/markdown.html
-
-### html
-
-Dynamically update html content as a document changes
-
-### markdown
-
-Dynamically render markdown as a document is edited.
-
-
-ace
----
-
-The ace editor live editing a sharejs document.
-
-Browse to http://localhost:8000/ace/
-
-
-staticrender
-------------
-
-This directory has a little mustache template rendering engine to do server-side rendering of documents.
-
-Access the rendered documents at http://localhost:8000/static/DOCNAME
-
-Eg: http://localhost:8000/static/html
-
-Some of the logic to wire this demo up is in `bin/exampleserver`. You should have a read.
-
-The documents are rendered statically on the server, so they don't update when as you edit them. You could obviously mix in the code from the html demo to make this also re-render as the document changes.
-
-
-wiki
-----
-
-A more complicated demo showing a wiki.
@@ -1,8 +0,0 @@
-This is a simple static renderer which uses mustache to render out an HTML page
-from the document named on the URL path.
-
-Access this demo by browsing to:
-/static/DOCNAME
-from your server.
-
-(Eg, try /static/html)
@@ -1,20 +0,0 @@
-# This statically renders the document.
-
-fs = require 'fs'
-Mustache = try
- require 'mustache'
-catch e
- {to_html: -> "<body><pre>% npm install mustache</pre> to use this demo."}
-
-template = fs.readFileSync "#{__dirname}/template.html.mu", 'utf8'
-
-module.exports = (docName, model, res, next) ->
- model.getSnapshot docName, (error, data) ->
- if data == null
- # The document does not exist
- next()
- else
- html = Mustache.to_html template, {content:data.snapshot, docName}
- res.writeHead 200, {'content-type': 'text/html'}
- res.end html
-
@@ -1,11 +0,0 @@
-<html>
- <head>
- <title>{{docName}}</title>
- <link href="/style.css" rel="stylesheet" type="text/css">
- </head>
- <body>
- <div id="container">
- <div id='text' class='content'>{{{content}}}</div>
- </div>
- </body>
-</html>
@@ -1,48 +0,0 @@
-# This statically renders the wiki.
-
-fs = require 'fs'
-Mustache = try
- require 'mustache'
-catch e
- {to_html: -> "<body><pre>% npm install mustache</pre> to use this demo."}
-
-showdown = new (require('../lib/markdown/showdown').converter)()
-
-template = fs.readFileSync "#{__dirname}/wiki.html.mu", 'utf8'
-
-defaultContent = (name) -> """
-# #{name} page
-
-This wiki page is currently empty.
-
-You can put some content in it with the editor on the right. As you do so, the document will update live on the left, and live for everyone else editing at the same time as you. Isn't that cool?
-
-The text on the left is being rendered with markdown, so you can do all the usual markdown stuff like:
-
-- Bullet
- - Points
-
-[links](http://google.com)
-
-[Go back to the main page](Main)
-"""
-
-render = (content, name, docName, res) ->
- markdown = showdown.makeHtml content
- html = Mustache.to_html template, {content, markdown, name, docName}
- res.writeHead 200, {'content-type': 'text/html'}
- res.end html
-
-module.exports = (docName, model, res) ->
- name = docName
- docName = "wiki:" + docName
-
- model.getSnapshot docName, (error, data) ->
- if error is 'Document does not exist'
- model.create docName, 'text', ->
- content = defaultContent(name)
- model.applyOp docName, {op:[{i:content, p:0}], v:0}, ->
- render content, name, docName, res
- else
- render data.snapshot, name, docName, res
-
View
@@ -1,49 +0,0 @@
-body {
- overflow: hidden;
-}
-
-#header {
- position: fixed;
- top: 0;
- right: 0;
- height: 30px;
- width: 100%;
- background-color: black;
-}
-
-#htext {
- line-height: 30px;
- vertical-align: middle;
-
- padding-left: 10px;
- color: white;
- font-family: baskerville, palatino, 'palatino linotype', georgia,serif;
-}
-
-#left {
- margin: 0;
- position: fixed;
- overflow: scroll;
- float: left;
- top: 30px;
- bottom: 0;
- left: 0;
- right: 0;
- width: 50%;
-}
-
-#view {
- padding-left: 30px;
- padding-right: 30px;
-}
-
-#editor {
- margin: 0;
- position: fixed;
- top: 30px;
- bottom: 0;
- left: 50%;
- width: 50%;
- right: 0;
-}
-
@@ -1,59 +0,0 @@
-<html>
- <head>
- <title>Wiki {{name}}</title>
- <link href="/_wiki/style.css" rel="stylesheet" type="text/css">
- </head>
-
- <body>
- <div id="header">
- <div id="htext">
- Wiki <strong>{{name}}</strong>
- </div>
- </div>
- <div id="left">
- <div id="view" class="content">{{{markdown}}}</div>
- </div>
- <div id="editor">{{{content}}}</div>
- <script src="/lib/markdown/showdown.js" type="text/javascript"></script>
- <script src="/lib/ace/ace.js" type="text/javascript" charset="utf-8"></script>
- <script src="/channel/bcsocket.js"></script>
- <script src="/share/share.uncompressed.js"></script>
- <script src="/share/ace.js"></script>
- <script>
-window.onload = function() {
- var converter = new Showdown.converter();
- var view = document.getElementById('view');
-
- var editor = ace.edit("editor");
- editor.setReadOnly(true);
- editor.session.setUseWrapMode(true);
- editor.setShowPrintMargin(false);
-
- // This could instead be written simply as:
- // sharejs.open('{{{docName}}}', function(doc, error) {
- // ...
-
- var connection = new sharejs.Connection('/channel');
-
- connection.open('{{{docName}}}', function(error, doc) {
- if (error) {
- console.error(error);
- return;
- }
- doc.attach_ace(editor);
- editor.setReadOnly(false);
-
- var render = function() {
- view.innerHTML = converter.makeHtml(doc.snapshot);
- };
-
- window.doc = doc;
-
- render();
- doc.on('change', render);
- });
-};
- </script>
- </body>
-</html>
-
Oops, something went wrong.

0 comments on commit 442b2a7

Please sign in to comment.