Merge branch 'master' into hendrik-testing
This commit is contained in:
@@ -33,7 +33,11 @@ function sendMessage() {
|
||||
$.post(
|
||||
"API/sendMessage.php",
|
||||
$("#sendMessageForm").serialize()
|
||||
);
|
||||
).done(function(response) {
|
||||
if (response == "frozen") {
|
||||
alert("Je account is bevroren, dus je kan niet chat berichten versturen. Contacteer een admin als je denkt dat dit onjuist is.");
|
||||
}
|
||||
});
|
||||
|
||||
$("#newContent").val("");
|
||||
loadMessages();
|
||||
|
||||
@@ -3,7 +3,7 @@ var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "a
|
||||
|
||||
function fancyText(text) {
|
||||
// Add links, images, gifs and (youtube) video's.
|
||||
var regex = /(https?:\/\/.[^ ]*)/ig;
|
||||
var regex = /(https?:\/\/.[^ <>"]*)/ig;
|
||||
text = text.replace(regex, function(link) {
|
||||
// Add images
|
||||
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
|
||||
@@ -93,4 +93,14 @@ function showGroups(groups, list) {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$("body").delegate("textarea[maxlength]", "keydown", function() {
|
||||
if ($(this).val().length / .9 >= $(this).attr("maxlength")) {
|
||||
$(this).next().text($(this).val().length + "/" + $(this).attr("maxlength"));
|
||||
} else {
|
||||
$(this).next().text("");
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -19,10 +19,32 @@ function requestPost(postID) {
|
||||
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
|
||||
scrollbarMargin(scrollBarWidth, 'hidden');
|
||||
$('#modal-response').show();
|
||||
$('#modal-response').html(data);
|
||||
$('#modal-response').html(fancyText(data));
|
||||
});
|
||||
}
|
||||
|
||||
function postPost() {
|
||||
title = $("input.newpost[name='title']").val();
|
||||
content = $("textarea.newpost[name='content']").val();
|
||||
|
||||
if (masonryMode == 2) {
|
||||
$.post("API/postPost.php", { title: title,
|
||||
content : content,
|
||||
group : groupID })
|
||||
.done(function() {
|
||||
masonry(masonryMode);
|
||||
});
|
||||
} else {
|
||||
$.post("API/postPost.php", { title: title,
|
||||
content : content })
|
||||
.done(function() {
|
||||
masonry(masonryMode);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$(window).on("load", function() {
|
||||
$(".modal-close").click(function () {
|
||||
$(".modal").hide();
|
||||
@@ -33,11 +55,15 @@ $(window).on("load", function() {
|
||||
});
|
||||
|
||||
var masonryMode = 0;
|
||||
var windowWidth = $(window).width();
|
||||
|
||||
$(window).resize(function() {
|
||||
clearTimeout(window.resizedFinished);
|
||||
window.resizeFinished = setTimeout(function() {
|
||||
masonry(masonryMode);
|
||||
if ($(window).width() != windowWidth) {
|
||||
windowWidth = $(window).width();
|
||||
masonry(masonryMode);
|
||||
}
|
||||
}, 250);
|
||||
});
|
||||
|
||||
@@ -52,7 +78,7 @@ function masonry(mode) {
|
||||
* Initialise columns.
|
||||
*/
|
||||
var columns = new Array(columnCount);
|
||||
var $columns = new Array(columnCount);
|
||||
|
||||
for (i = 0; i < columnCount; i++) {
|
||||
$column = $("<div class=\"column\">");
|
||||
$column.width(100/columnCount + "%");
|
||||
@@ -60,13 +86,17 @@ function masonry(mode) {
|
||||
columns[i] = [0, $column];
|
||||
}
|
||||
|
||||
if(mode == 1) {
|
||||
if(mode > 0) {
|
||||
$postInput = $("<div class=\"post platform\">");
|
||||
$form = $("<form action=\"API/postPost.php\" method=\"post\">");
|
||||
$form = $("<form class=\"newpost\" action=\"API/postPost.php\" method=\"post\" onsubmit=\"postPost(); return false;\">");
|
||||
$postInput.append($form);
|
||||
|
||||
$form.append($("<input class=\"newpost\" name=\"newpost-title\" placeholder=\"Titel\" type=\"text\">"));
|
||||
$form.append($("<textarea class=\"newpost\" name=\"newpost-content\" placeholder=\"Schrijf een berichtje...\">"));
|
||||
if(mode == 2) {
|
||||
$form.append($("<input class=\"newpost\" type=\"hidden\" name=\"group\" value=\"" + groupID + "\">"));
|
||||
}
|
||||
|
||||
$form.append($("<input class=\"newpost\" name=\"title\" placeholder=\"Titel\" type=\"text\">"));
|
||||
$form.append($("<textarea class=\"newpost\" name=\"content\" placeholder=\"Schrijf een berichtje...\" maxlength='1000'></textarea><span></span>"));
|
||||
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
||||
columns[0][1].append($postInput);
|
||||
|
||||
@@ -100,7 +130,7 @@ function masonry(mode) {
|
||||
$.each(posts, function() {
|
||||
$post = $("<div class=\"post platform\" onclick=\"requestPost(\'"+this['postID']+"\')\">");
|
||||
$post.append($("<h2>").html(this["title"]));
|
||||
$post.append($("<p>").html(this["content"]));
|
||||
$post.append($("<p>").html(fancyText(this["content"])));
|
||||
$post.append($("<p class=\"subscript\">").text(this["nicetime"]));
|
||||
$post.append($("<p class=\"subscript\">").text("comments: " + this["comments"] + ", niet slechts: " + this["niet_slechts"]));
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@ function postComment(buttonValue) {
|
||||
$.post(
|
||||
"API/postComment.php",
|
||||
formData
|
||||
).done(function(data) {
|
||||
console.log(data);
|
||||
).done(function (response) {
|
||||
if (response == "frozen") {
|
||||
alert("Je account is bevroren, dus je kan geen comments plaatsen of \"niet slechten\". Contacteer een admin als je denkt dat dit onjuist is.");
|
||||
}
|
||||
});
|
||||
|
||||
$("#newcomment").val("");
|
||||
@@ -15,6 +17,6 @@ function postComment(buttonValue) {
|
||||
"API/loadPost.php",
|
||||
$("#newcommentform").serialize()
|
||||
).done(function (data) {
|
||||
$('#modal-response').html(data);
|
||||
$('#modal-response').html(fancyText(data));
|
||||
});
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
function searchUsers(n, m) {
|
||||
$(window).on('load', function () {
|
||||
pageNumber();
|
||||
});
|
||||
|
||||
function searchUsers() {
|
||||
$.post(
|
||||
"API/searchUsers.php",
|
||||
{
|
||||
n: n,
|
||||
m: m,
|
||||
search: $("#search-input").val(),
|
||||
filter: $("#search-filter").val()
|
||||
}
|
||||
$('#search-form').serialize()
|
||||
).done(function(data) {
|
||||
if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) {
|
||||
$("#search-users-list").text("Niemand gevonden");
|
||||
@@ -14,18 +13,29 @@ function searchUsers(n, m) {
|
||||
});
|
||||
}
|
||||
|
||||
function searchGroups(n, m) {
|
||||
function searchGroups() {
|
||||
$.post(
|
||||
"API/searchGroups.php",
|
||||
{
|
||||
n: n,
|
||||
m: m,
|
||||
search: $("#search-input").val(),
|
||||
filter: $("#search-filter").val()
|
||||
}
|
||||
$('#search-form').serialize()
|
||||
).done(function(data) {
|
||||
if (!showGroups(data, "#search-groups-list")) {
|
||||
$("#search-groups-list").text("Geen groepen gevonden");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function pageNumber() {
|
||||
var input = input2 = $('#search-form').serialize();
|
||||
$.post(
|
||||
"API/searchPageNumber.php",
|
||||
input + "&option=user"
|
||||
).done(function (data) {
|
||||
$('#user-pageselect').html(data);
|
||||
});
|
||||
$.post(
|
||||
"API/searchPageNumber.php",
|
||||
input2 + "&option=group"
|
||||
).done(function (data) {
|
||||
$('#group-pageselect').html(data);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user