2 elgg.provide(
'elgg.comments');
9 elgg.comments.Comment =
function (guid,
item) {
14 elgg.comments.Comment.prototype = {
20 getForm:
function () {
21 return this.
$item.find(
'.elgg-form-comment-save');
27 hideForm:
function (complete) {
28 complete = complete ||
function () {};
29 this.getForm().slideUp(
'fast', complete).data(
'hidden', 1);
32 showForm:
function () {
33 this.getForm().slideDown(
'medium').data(
'hidden', 0);
36 loadForm:
function () {
39 require([
'elgg/Ajax'],
function(Ajax) {
40 var
ajax =
new Ajax();
43 ajax.view(
'core/ajax/edit_comment?guid=' + that.guid, {
44 success: function(html) {
46 that.$item.find(
'.elgg-body').first().append(html);
50 var $form = that.getForm();
52 $form.find(
'.elgg-button-cancel').on(
'click', function () {
58 $form.on(
'submit', function () {
67 submitForm:
function () {
69 $form = this.getForm(),
70 value =
$form.find(
'textarea[name=generic_comment]').val();
72 elgg.action(
'comment/save', {
73 data:
$form.serialize(),
81 return content.replace(/([^>\
r\n]?)(\
r\n|\n\
r|\
r|\n)/g,
'$1<br>$2');
84 if (json.status === 0) {
87 that.$item.find(
'[data-role="comment-text"]').replaceWith(json.output);
90 that.$item.find(
'[data-role="comment-text"]').html(nl2br(value));
93 that.hideForm(
function () {
94 that.getForm().remove();
102 toggleEdit:
function () {
103 var
$form = this.getForm();
105 if ($form.data(
'hidden')) {
122 elgg.comments.init =
function() {
123 $(
document).
on(
'click',
'.elgg-item-object-comment .elgg-menu-item-edit > a',
function () {
125 var dc = $(
this).data(
'Comment'),
128 guid = this.href.split(
'/').pop();
129 dc =
new elgg.comments.Comment(guid, $(
this).closest(
'.elgg-item-object-comment'));
130 $(
this).data(
'Comment', dc);
137 elgg.register_hook_handler(
'init',
'system',
elgg.comments.init);
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed on
elgg ajax
Wrapper function for jQuery.ajax which ensures that the url being called is relative to the elgg site...
friends picker navigation friends picker navigation r
elgg require
Throw an error if the required package isn't present.
GNU GENERAL PUBLIC LICENSE June Free Software Inc Franklin Fifth MA USA Everyone is permitted to copy and distribute verbatim copies of this license document
elgg message elgg state success