|
@@ -118,6 +118,16 @@ $(document).ready(function() {
|
|
|
$("button.publish_canvas").show();
|
|
|
}
|
|
|
|
|
|
+ /* ================================================
|
|
|
+ If the user is using Try Online, show the Collaborators button
|
|
|
+ ================================================= */
|
|
|
+
|
|
|
+ // If the user isn't logged in
|
|
|
+ if(username === "") {
|
|
|
+ $("div#collaborators-container").show();
|
|
|
+ $("div#collaborators-container").css("right", "50px");
|
|
|
+ }
|
|
|
+
|
|
|
/* ================================================
|
|
|
Generate generic ID
|
|
|
================================================= */
|
|
@@ -322,18 +332,27 @@ $(document).ready(function() {
|
|
|
|
|
|
// If the user clicks on the "Collaborators" button, show the collaborators window
|
|
|
$("div#collaborators button").on("click", function() {
|
|
|
- // Show the collaborators window
|
|
|
- $("div#shadow").css("display", "block");
|
|
|
- $("div#collaborators-window").css("display", "block");
|
|
|
-
|
|
|
- // In 1.5 seconds
|
|
|
- window.setTimeout(function() {
|
|
|
- // If the canvas is new
|
|
|
- if(canvasIsNew === true) {
|
|
|
- // Save the canvas
|
|
|
- prepareSaveCanvas();
|
|
|
- }
|
|
|
- }, 1500);
|
|
|
+ // If the user is logged in
|
|
|
+ if($("input[name='username']").val() != "") {
|
|
|
+ // Show the collaborators window
|
|
|
+ $("div#shadow").css("display", "block");
|
|
|
+ $("div#collaborators-window").css("display", "block");
|
|
|
+
|
|
|
+ // In 1.5 seconds
|
|
|
+ window.setTimeout(function() {
|
|
|
+ // If the canvas is new
|
|
|
+ if(canvasIsNew === true) {
|
|
|
+ // Save the canvas
|
|
|
+ prepareSaveCanvas();
|
|
|
+ }
|
|
|
+ }, 1500);
|
|
|
+ }
|
|
|
+ // If the user isn't logged in
|
|
|
+ else {
|
|
|
+ // Show a dialog
|
|
|
+ $("div#shadow").css("display", "block");
|
|
|
+ $("div#dialog-log-in").css("display", "block");
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// Close the collaborators window
|
|
@@ -1299,12 +1318,13 @@ $(document).ready(function() {
|
|
|
|
|
|
// If the user clicks on a tag
|
|
|
function showTagWindowOnTagClick() {
|
|
|
- $("span.tag-with-badge-effect").on("click", function() {
|
|
|
- // Declarations
|
|
|
- tag = $(this).text();
|
|
|
-
|
|
|
+ $("span.tag-with-badge-effect").on("click", function() {
|
|
|
// If the user is logged in
|
|
|
if($("input[name='username']").val() != "") {
|
|
|
+ // Declarations
|
|
|
+ tag = $(this).text();
|
|
|
+
|
|
|
+ // Remember that the tag window is open
|
|
|
tagWindowIsOpen = true;
|
|
|
|
|
|
// Show the tag window
|
|
@@ -2349,17 +2369,26 @@ $(document).ready(function() {
|
|
|
|
|
|
// If the user clicks on the "Comment" icon, show the comments window
|
|
|
$(".card").on("click", "span.comment", function() {
|
|
|
- // Show the move window
|
|
|
- $("div#shadow").css("display", "block");
|
|
|
- $("div#comments-window").css("display", "block");
|
|
|
-
|
|
|
- // Remember the ID of the idea
|
|
|
- currentCommentsId = $(this).parent().find("div").prop("id");
|
|
|
-
|
|
|
- // Get commments
|
|
|
- getComments();
|
|
|
-
|
|
|
- updateRemainingCharacters();
|
|
|
+ // If the user is logged in
|
|
|
+ if($("input[name='username']").val() != "") {
|
|
|
+ // Show the move window
|
|
|
+ $("div#shadow").css("display", "block");
|
|
|
+ $("div#comments-window").css("display", "block");
|
|
|
+
|
|
|
+ // Remember the ID of the idea
|
|
|
+ currentCommentsId = $(this).parent().find("div").prop("id");
|
|
|
+
|
|
|
+ // Get commments
|
|
|
+ getComments();
|
|
|
+
|
|
|
+ updateRemainingCharacters();
|
|
|
+ }
|
|
|
+ // If the user isn't logged in
|
|
|
+ else {
|
|
|
+ // Show a dialog
|
|
|
+ $("div#shadow").css("display", "block");
|
|
|
+ $("div#dialog-log-in").css("display", "block");
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// Close the comments window
|
|
@@ -3061,28 +3090,37 @@ $(document).ready(function() {
|
|
|
// Prevent default operation
|
|
|
event.preventDefault();
|
|
|
|
|
|
- // AJAX
|
|
|
- $.ajax({
|
|
|
- type: "POST",
|
|
|
- url: "php/toggle-public.php",
|
|
|
- dataType: "TEXT",
|
|
|
- data: {
|
|
|
- "canvas_id": canvasId
|
|
|
- },
|
|
|
- timeout: 5000,
|
|
|
- success: function(returnData) {
|
|
|
- if(returnData === "0") {
|
|
|
- $("button.publish_canvas").text("Publish for viewing/commenting");
|
|
|
- }
|
|
|
- else if(returnData === "1") {
|
|
|
- $("button.publish_canvas").text("Unpublish for viewing/commenting");
|
|
|
+ // If the user is logged in
|
|
|
+ if($("input[name='username']").val() != "") {
|
|
|
+ // AJAX
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: "php/toggle-public.php",
|
|
|
+ dataType: "TEXT",
|
|
|
+ data: {
|
|
|
+ "canvas_id": canvasId
|
|
|
+ },
|
|
|
+ timeout: 5000,
|
|
|
+ success: function(returnData) {
|
|
|
+ if(returnData === "0") {
|
|
|
+ $("button.publish_canvas").text("Publish for viewing/commenting");
|
|
|
+ }
|
|
|
+ else if(returnData === "1") {
|
|
|
+ $("button.publish_canvas").text("Unpublish for viewing/commenting");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(xhr) {
|
|
|
+ console.log(xhr.statusText);
|
|
|
}
|
|
|
- },
|
|
|
- error: function(xhr) {
|
|
|
- console.log(xhr.statusText);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // If the user isn't logged in
|
|
|
+ else {
|
|
|
+ // Show a dialog
|
|
|
+ $("div#shadow").css("display", "block");
|
|
|
+ $("div#dialog-log-in").css("display", "block");
|
|
|
+ }
|
|
|
+
|
|
|
return false;
|
|
|
});
|
|
|
|