diff --git a/jsfiddles/create_room_send_msg/demo.css b/jsfiddles/create_room_send_msg/demo.css
deleted file mode 100644
index 48a55f372..000000000
--- a/jsfiddles/create_room_send_msg/demo.css
+++ /dev/null
@@ -1,17 +0,0 @@
-.loggedin {
- visibility: hidden;
-}
-
-p {
- font-family: monospace;
-}
-
-table
-{
- border-spacing:5px;
-}
-
-th,td
-{
- padding:5px;
-}
diff --git a/jsfiddles/create_room_send_msg/demo.html b/jsfiddles/create_room_send_msg/demo.html
deleted file mode 100644
index 088ff7ac0..000000000
--- a/jsfiddles/create_room_send_msg/demo.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
This room creation / message sending demo requires a home server to be running on http://localhost:8008
-
-
-
-
-
-
-
-
- Room ID |
- My state |
- Room Alias |
- Latest message |
-
-
-
-
-
diff --git a/jsfiddles/create_room_send_msg/demo.js b/jsfiddles/create_room_send_msg/demo.js
deleted file mode 100644
index 9c346e2f6..000000000
--- a/jsfiddles/create_room_send_msg/demo.js
+++ /dev/null
@@ -1,113 +0,0 @@
-var accountInfo = {};
-
-var showLoggedIn = function(data) {
- accountInfo = data;
- getCurrentRoomList();
- $(".loggedin").css({visibility: "visible"});
-};
-
-$('.login').live('click', function() {
- var user = $("#userLogin").val();
- var password = $("#passwordLogin").val();
- $.ajax({
- url: "http://localhost:8008/_matrix/client/api/v1/login",
- type: "POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify({ user: user, password: password, type: "m.login.password" }),
- dataType: "json",
- success: function(data) {
- showLoggedIn(data);
- },
- error: function(err) {
- var errMsg = "To try this, you need a home server running!";
- var errJson = $.parseJSON(err.responseText);
- if (errJson) {
- errMsg = JSON.stringify(errJson);
- }
- alert(errMsg);
- }
- });
-});
-
-var getCurrentRoomList = function() {
- var url = "http://localhost:8008/_matrix/client/api/v1/initialSync?access_token=" + accountInfo.access_token + "&limit=1";
- $.getJSON(url, function(data) {
- var rooms = data.rooms;
- for (var i=0; i 0) {
- data.room_alias_name = roomAlias;
- }
- $.ajax({
- url: "http://localhost:8008/_matrix/client/api/v1/createRoom?access_token="+accountInfo.access_token,
- type: "POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify(data),
- dataType: "json",
- success: function(data) {
- data.membership = "join"; // you are automatically joined into every room you make.
- data.latest_message = "";
- addRoom(data);
- },
- error: function(err) {
- alert(JSON.stringify($.parseJSON(err.responseText)));
- }
- });
-});
-
-var addRoom = function(data) {
- row = "" +
- ""+data.room_id+" | " +
- ""+data.membership+" | " +
- ""+data.room_alias+" | " +
- ""+data.latest_message+" | " +
- "
";
- $("#rooms").append(row);
-};
-
-$('.sendMessage').live('click', function() {
- var roomId = $("#roomId").val();
- var body = $("#messageBody").val();
- var msgId = $.now();
-
- if (roomId.length === 0 || body.length === 0) {
- return;
- }
-
- var url = "http://localhost:8008/_matrix/client/api/v1/rooms/$roomid/send/m.room.message?access_token=$token";
- url = url.replace("$token", accountInfo.access_token);
- url = url.replace("$roomid", encodeURIComponent(roomId));
-
- var data = {
- msgtype: "m.text",
- body: body
- };
-
- $.ajax({
- url: url,
- type: "POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify(data),
- dataType: "json",
- success: function(data) {
- $("#messageBody").val("");
- // wipe the table and reload it. Using the event stream would be the best
- // solution but that is out of scope of this fiddle.
- $("#rooms").find("tr:gt(0)").remove();
- getCurrentRoomList();
- },
- error: function(err) {
- alert(JSON.stringify($.parseJSON(err.responseText)));
- }
- });
-});
diff --git a/jsfiddles/event_stream/demo.css b/jsfiddles/event_stream/demo.css
deleted file mode 100644
index 48a55f372..000000000
--- a/jsfiddles/event_stream/demo.css
+++ /dev/null
@@ -1,17 +0,0 @@
-.loggedin {
- visibility: hidden;
-}
-
-p {
- font-family: monospace;
-}
-
-table
-{
- border-spacing:5px;
-}
-
-th,td
-{
- padding:5px;
-}
diff --git a/jsfiddles/event_stream/demo.html b/jsfiddles/event_stream/demo.html
deleted file mode 100644
index 7657780d2..000000000
--- a/jsfiddles/event_stream/demo.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
This event stream demo requires a home server to be running on http://localhost:8008
-
-
-
-
-
-
-
-
- Room ID |
- Latest message |
-
-
-
-
-
diff --git a/jsfiddles/event_stream/demo.js b/jsfiddles/event_stream/demo.js
deleted file mode 100644
index acba8391f..000000000
--- a/jsfiddles/event_stream/demo.js
+++ /dev/null
@@ -1,145 +0,0 @@
-var accountInfo = {};
-
-var eventStreamInfo = {
- from: "END"
-};
-
-var roomInfo = [];
-
-var longpollEventStream = function() {
- var url = "http://localhost:8008/_matrix/client/api/v1/events?access_token=$token&from=$from";
- url = url.replace("$token", accountInfo.access_token);
- url = url.replace("$from", eventStreamInfo.from);
-
- $.getJSON(url, function(data) {
- eventStreamInfo.from = data.end;
-
- var hasNewLatestMessage = false;
- for (var i=0; i"+roomList[i].room_id+"" +
- ""+roomList[i].latest_message+" | " +
- "";
- rows += row;
- }
-
- $("#rooms").append(rows);
-};
-
diff --git a/jsfiddles/example_app/demo.css b/jsfiddles/example_app/demo.css
deleted file mode 100644
index 4c1e157cc..000000000
--- a/jsfiddles/example_app/demo.css
+++ /dev/null
@@ -1,43 +0,0 @@
-.roomListDashboard, .roomContents, .sendMessageForm {
- visibility: hidden;
-}
-
-.roomList {
- background-color: #909090;
-}
-
-.messageWrapper {
- background-color: #EEEEEE;
- height: 400px;
- overflow: scroll;
-}
-
-.membersWrapper {
- background-color: #EEEEEE;
- height: 200px;
- width: 50%;
- overflow: scroll;
-}
-
-.textEntry {
- width: 100%
-}
-
-p {
- font-family: monospace;
-}
-
-table
-{
- border-spacing:5px;
-}
-
-th,td
-{
- padding:5px;
-}
-
-.roomList tr:not(:first-child):hover {
- background-color: orange;
- cursor: pointer;
-}
diff --git a/jsfiddles/example_app/demo.details b/jsfiddles/example_app/demo.details
deleted file mode 100644
index 3f96d3e74..000000000
--- a/jsfiddles/example_app/demo.details
+++ /dev/null
@@ -1,7 +0,0 @@
- name: Example Matrix Client
- description: Includes login, live event streaming, creating rooms, sending messages and viewing member lists.
- authors:
- - matrix.org
- resources:
- - http://matrix.org
- normalize_css: no
\ No newline at end of file
diff --git a/jsfiddles/example_app/demo.html b/jsfiddles/example_app/demo.html
deleted file mode 100644
index 7a9dffddd..000000000
--- a/jsfiddles/example_app/demo.html
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
Matrix example application: Requires a local home server running at http://localhost:8008
-
-
-
-
-
-
-
-
-
- Room |
- My state |
- Latest message |
-
-
-
-
-
-
-
-
-
diff --git a/jsfiddles/example_app/demo.js b/jsfiddles/example_app/demo.js
deleted file mode 100644
index 13c9c2b33..000000000
--- a/jsfiddles/example_app/demo.js
+++ /dev/null
@@ -1,327 +0,0 @@
-var accountInfo = {};
-
-var eventStreamInfo = {
- from: "END"
-};
-
-var roomInfo = [];
-var memberInfo = [];
-var viewingRoomId;
-
-// ************** Event Streaming **************
-var longpollEventStream = function() {
- var url = "http://localhost:8008/_matrix/client/api/v1/events?access_token=$token&from=$from";
- url = url.replace("$token", accountInfo.access_token);
- url = url.replace("$from", eventStreamInfo.from);
-
- $.getJSON(url, function(data) {
- eventStreamInfo.from = data.end;
-
- var hasNewLatestMessage = false;
- var updatedMemberList = false;
- var i=0;
- var j=0;
- for (i=0; i 0) {
- data.room_alias_name = roomAlias;
- }
- $.ajax({
- url: "http://localhost:8008/_matrix/client/api/v1/createRoom?access_token="+accountInfo.access_token,
- type: "POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify(data),
- dataType: "json",
- success: function(response) {
- $("#roomAlias").val("");
- response.membership = "join"; // you are automatically joined into every room you make.
- response.latest_message = "";
-
- roomInfo.push(response);
- setRooms(roomInfo);
- },
- error: function(err) {
- alert(JSON.stringify($.parseJSON(err.responseText)));
- }
- });
-});
-
-// ************** Getting current state **************
-var getCurrentRoomList = function() {
- var url = "http://localhost:8008/_matrix/client/api/v1/initialSync?access_token=" + accountInfo.access_token + "&limit=1";
- $.getJSON(url, function(data) {
- var rooms = data.rooms;
- for (var i=0; i=0; --i) {
- addMessage(data.chunk[i]);
- }
- });
-};
-
-var getMemberList = function(roomId) {
- $("#members").empty();
- memberInfo = [];
- var url = "http://localhost:8008/_matrix/client/api/v1/rooms/" +
- encodeURIComponent(roomId) + "/members?access_token=" + accountInfo.access_token;
- $.getJSON(url, function(data) {
- for (var i=0; i"+roomList[i].room_id+"" +
- ""+roomList[i].membership+" | " +
- ""+roomList[i].latest_message+" | " +
- "";
- rows += row;
- }
-
- $("#rooms").append(rows);
-
- $('#rooms').find("tr").click(function(){
- var roomId = $(this).find('td:eq(0)').text();
- var membership = $(this).find('td:eq(1)').text();
- if (membership !== "join") {
- console.log("Joining room " + roomId);
- var url = "http://localhost:8008/_matrix/client/api/v1/rooms/$roomid/join?access_token=$token";
- url = url.replace("$token", accountInfo.access_token);
- url = url.replace("$roomid", encodeURIComponent(roomId));
- $.ajax({
- url: url,
- type: "POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify({membership: "join"}),
- dataType: "json",
- success: function(data) {
- loadRoomContent(roomId);
- getCurrentRoomList();
- },
- error: function(err) {
- alert(JSON.stringify($.parseJSON(err.responseText)));
- }
- });
- }
- else {
- loadRoomContent(roomId);
- }
- });
-};
-
-var addMessage = function(data) {
-
- var msg = data.content.body;
- if (data.type === "m.room.member") {
- if (data.content.membership === undefined) {
- return;
- }
- if (data.content.membership === "invite") {
- msg = "invited " + data.state_key + " to the room";
- }
- else if (data.content.membership === "join") {
- msg = "joined the room";
- }
- else if (data.content.membership === "leave") {
- msg = "left the room";
- }
- else if (data.content.membership === "ban") {
- msg = "was banned from the room";
- }
- }
- if (msg === undefined) {
- return;
- }
-
- var row = "" +
- ""+data.user_id+" | " +
- ""+msg+" | " +
- "
";
- $("#messages").append(row);
-};
-
-var addMember = function(data) {
- var row = "" +
- ""+data.state_key+" | " +
- ""+data.content.membership+" | " +
- "
";
- $("#members").append(row);
-};
-
diff --git a/jsfiddles/register_login/demo.css b/jsfiddles/register_login/demo.css
deleted file mode 100644
index 11781c250..000000000
--- a/jsfiddles/register_login/demo.css
+++ /dev/null
@@ -1,7 +0,0 @@
-.loggedin {
- visibility: hidden;
-}
-
-p {
- font-family: monospace;
-}
diff --git a/jsfiddles/register_login/demo.html b/jsfiddles/register_login/demo.html
deleted file mode 100644
index fcac453ac..000000000
--- a/jsfiddles/register_login/demo.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
This registration/login demo requires a home server to be running on http://localhost:8008
-
-
-
-
-
diff --git a/jsfiddles/register_login/demo.js b/jsfiddles/register_login/demo.js
deleted file mode 100644
index 2e6957b63..000000000
--- a/jsfiddles/register_login/demo.js
+++ /dev/null
@@ -1,79 +0,0 @@
-var accountInfo = {};
-
-var showLoggedIn = function(data) {
- accountInfo = data;
- $(".loggedin").css({visibility: "visible"});
- $("#welcomeText").text("Welcome " + accountInfo.user_id+". Your access token is: " +
- accountInfo.access_token);
-};
-
-$('.register').live('click', function() {
- var user = $("#user").val();
- var password = $("#password").val();
- $.ajax({
- url: "http://localhost:8008/_matrix/client/api/v1/register",
- type: "POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify({ user: user, password: password, type: "m.login.password" }),
- dataType: "json",
- success: function(data) {
- showLoggedIn(data);
- },
- error: function(err) {
- var errMsg = "To try this, you need a home server running!";
- var errJson = $.parseJSON(err.responseText);
- if (errJson) {
- errMsg = JSON.stringify(errJson);
- }
- alert(errMsg);
- }
- });
-});
-
-var login = function(user, password) {
- $.ajax({
- url: "http://localhost:8008/_matrix/client/api/v1/login",
- type: "POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify({ user: user, password: password, type: "m.login.password" }),
- dataType: "json",
- success: function(data) {
- showLoggedIn(data);
- },
- error: function(err) {
- var errMsg = "To try this, you need a home server running!";
- var errJson = $.parseJSON(err.responseText);
- if (errJson) {
- errMsg = JSON.stringify(errJson);
- }
- alert(errMsg);
- }
- });
-};
-
-$('.login').live('click', function() {
- var user = $("#userLogin").val();
- var password = $("#passwordLogin").val();
- $.getJSON("http://localhost:8008/_matrix/client/api/v1/login", function(data) {
- if (data.flows[0].type !== "m.login.password") {
- alert("I don't know how to login with this type: " + data.type);
- return;
- }
- login(user, password);
- });
-});
-
-$('.logout').live('click', function() {
- accountInfo = {};
- $("#imSyncText").text("");
- $(".loggedin").css({visibility: "hidden"});
-});
-
-$('.testToken').live('click', function() {
- var url = "http://localhost:8008/_matrix/client/api/v1/initialSync?access_token=" + accountInfo.access_token + "&limit=1";
- $.getJSON(url, function(data) {
- $("#imSyncText").text(JSON.stringify(data, undefined, 2));
- }).fail(function(err) {
- $("#imSyncText").text(JSON.stringify($.parseJSON(err.responseText)));
- });
-});
diff --git a/jsfiddles/room_memberships/demo.css b/jsfiddles/room_memberships/demo.css
deleted file mode 100644
index 48a55f372..000000000
--- a/jsfiddles/room_memberships/demo.css
+++ /dev/null
@@ -1,17 +0,0 @@
-.loggedin {
- visibility: hidden;
-}
-
-p {
- font-family: monospace;
-}
-
-table
-{
- border-spacing:5px;
-}
-
-th,td
-{
- padding:5px;
-}
diff --git a/jsfiddles/room_memberships/demo.html b/jsfiddles/room_memberships/demo.html
deleted file mode 100644
index e6f39df5a..000000000
--- a/jsfiddles/room_memberships/demo.html
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
This room membership demo requires a home server to be running on http://localhost:8008
-
-
-
-
-
-
-
-
-
- Room ID |
- My state |
- Room Alias |
-
-
-
-
-
diff --git a/jsfiddles/room_memberships/demo.js b/jsfiddles/room_memberships/demo.js
deleted file mode 100644
index 8a7b1aa88..000000000
--- a/jsfiddles/room_memberships/demo.js
+++ /dev/null
@@ -1,141 +0,0 @@
-var accountInfo = {};
-
-var showLoggedIn = function(data) {
- accountInfo = data;
- getCurrentRoomList();
- $(".loggedin").css({visibility: "visible"});
- $("#membership").change(function() {
- if ($("#membership").val() === "invite") {
- $("#targetUser").css({visibility: "visible"});
- }
- else {
- $("#targetUser").css({visibility: "hidden"});
- }
-});
-};
-
-$('.login').live('click', function() {
- var user = $("#userLogin").val();
- var password = $("#passwordLogin").val();
- $.ajax({
- url: "http://localhost:8008/_matrix/client/api/v1/login",
- type: "POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify({ user: user, password: password, type: "m.login.password" }),
- dataType: "json",
- success: function(data) {
- $("#rooms").find("tr:gt(0)").remove();
- showLoggedIn(data);
- },
- error: function(err) {
- var errMsg = "To try this, you need a home server running!";
- var errJson = $.parseJSON(err.responseText);
- if (errJson) {
- errMsg = JSON.stringify(errJson);
- }
- alert(errMsg);
- }
- });
-});
-
-var getCurrentRoomList = function() {
- $("#roomId").val("");
- // wipe the table and reload it. Using the event stream would be the best
- // solution but that is out of scope of this fiddle.
- $("#rooms").find("tr:gt(0)").remove();
-
- var url = "http://localhost:8008/_matrix/client/api/v1/initialSync?access_token=" + accountInfo.access_token + "&limit=1";
- $.getJSON(url, function(data) {
- var rooms = data.rooms;
- for (var i=0; i"+data.room_id+"" +
- ""+data.membership+" | " +
- ""+data.room_alias+" | " +
- "";
- $("#rooms").append(row);
-};
-
-$('.changeMembership').live('click', function() {
- var roomId = $("#roomId").val();
- var member = $("#targetUser").val();
- var membership = $("#membership").val();
-
- if (roomId.length === 0) {
- return;
- }
-
- var url = "http://localhost:8008/_matrix/client/api/v1/rooms/$roomid/$membership?access_token=$token";
- url = url.replace("$token", accountInfo.access_token);
- url = url.replace("$roomid", encodeURIComponent(roomId));
- url = url.replace("$membership", membership);
-
- var data = {};
-
- if (membership === "invite") {
- data = {
- user_id: member
- };
- }
-
- $.ajax({
- url: url,
- type: "POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify(data),
- dataType: "json",
- success: function(data) {
- getCurrentRoomList();
- },
- error: function(err) {
- alert(JSON.stringify($.parseJSON(err.responseText)));
- }
- });
-});
-
-$('.joinAlias').live('click', function() {
- var roomAlias = $("#roomAlias").val();
- var url = "http://localhost:8008/_matrix/client/api/v1/join/$roomalias?access_token=$token";
- url = url.replace("$token", accountInfo.access_token);
- url = url.replace("$roomalias", encodeURIComponent(roomAlias));
- $.ajax({
- url: url,
- type: "POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify({}),
- dataType: "json",
- success: function(data) {
- getCurrentRoomList();
- },
- error: function(err) {
- alert(JSON.stringify($.parseJSON(err.responseText)));
- }
- });
-});