Comments - danopia/deviantart-difi GitHub Wiki
This class is used to interact with comments (such as posting, editing, viewing, etc) on the website.
Posts a comment on anything that can be commented on.
When replying to a comment, the typeid
/itemid
params still refer to the root object.
- When submitting a new comment on anything, e.g. journals, deviations, profile pages, etc.
- When replying to an existing comment.
-
comment
: string (e.g. "Hey, what's up? :P") -
itemid
: number, id of the object you're commenting on (e.g. "38345086") -
parentid
: number, 0 if no parent comment -
typeid
: string, type of the object you're commenting on (e.g. 4 for the profile page) -
ownerid
: number or 0
An extensive list of typeids
is available in the Resource Types page.
-
On success, an object is returned that includes an HTML version of the comment plus some info about it.
This basically has enough information to display the stock HTML representation of the comment in the view.{"success":true, "body":"Hey, what's up? <img src=\"http:\/\/e.deviantart.net\/emoticons\/letters\/=p.gif\" width=\"15\" height=\"15\" alt=\":P\" title=\":P (Lick)\"\/>", "id":1865963218, "commentid":1865963218, "typeid":5, "itemid":38345086, "parentid":0, "velocity":false, "owner_userid":16076817, "ts":1297300063, "username":"danopia", "symbol":"~", "usericon":"10", "commentid":1865963218, "attributes":0, "mood":0, "html":"\n <div class=\"ccomment ch\" name=\"gmi-CComment\" id=\"gmi-CComment\" data-gmiclass=\"CComment\" gmi-commentid=\"1865963218\" gmi-itemid=\"38345086\" gmi-typeid=\"5\" gmi-private=\"0\" gmi-hidemoods=\"1\" gmi-allowdrawings=\"1\" gmi-splitid=\"16076817\"> . . . <\/div>"}
-
On fail, possible returns are:
-
error
: "The user you are commenting on has deactivated their account."
-
Previews a comment while typing them, parses all formatting into HTML.
- When previewing a comment.
-
TextToSave
: string (e.g. "Hey, what's up? :P") -
previewHasThumbs
: number (e.g. "1")
Returns a simple string with the HTML version of the comment.
Example:
"Hey, what's up? <img src=\"http:\/\/e.deviantart.net\/emoticons\/letters\/=p.gif\" width=\"15\" height=\"15\" alt=\":P\" title=\":P (Lick)\"\/>"
Previews a comment, parsing all formatting into HTML, new dA call.
- When previewing a comment.
-
TextToSave
: string (e.g. "Hey, what's up? :P") -
previewHasThumbs
: boolean, e.g. "1" -
typeid
: number, e.g. "1" -
itemid
: number, e.g. "426223868"
NOTE: previewHasThums
refer to whether this type of comment allows for thumbnails in previews.
Returns a simple string with the HTML version of the comment.
This is an example from dAhub Contest widget that utilizes the DiFi object:
DiFi.pushPost("Comments","preview_v2",[zwiicon,"1","1","426223868"],function(success, data){
var imgrex=/<a (?:[^>]*?)><img (?:[^>]*?)><\/a>/gi;
var iconlist=data.response.content.match(imgrex);
$("<div id='dahub_icon_temp'>").attr("data",JSON.stringify(iconlist)).appendTo($("body"));
$("#dAhub_CM_Tab.selected").click();
});
DiFi.send();
REMOVED
– This call seems to have been removed and not used anymore.
Returns HTML text and signature of the specified comment
- When viewing a comment?
-
comment_id
: number -
type_id
: number -
item_id
: number -
user_id
: number (for sig)
Returns the comment in HTML
- text: the comment body
-
signature: the user's signature (defaults to
null
)
Returns the instance for the parent comment of a reply in the Message Center.
- When the view "Original" button on a comment is clicked
-
item_id
: number, the object which the comment is made on -
comment_id
: number, the comment id
- On success, returns:
-
commentid
: number, the comment id -
parentid
: number, the parent comment id -
typeid
: number, the resource type id of the item -
itemid
: number, the object id which the comment is made on -
attributes
: number, ??? (e.g. 0) -
userid
: number, the user id of the commenter -
ts
: number, the creation timestamp of the comment -
edit_ts
: number, the edit timestamp, or 0 if none -
replies
: number, the number of replies to the parent -
like_counter
: number, ??? -
username
: string, the username of the commenter -
usericon
: number, refer to the User class -
symbol
: string, e.g.~
-
joindate
: number, the timestamp of the comment's join date -
extra
: object:-
specialty
: number (e.g. 0) -
skill_level
: number (e.g. 0) -
user_type
: number (e.g. 1)
-
-
body
: string, the content of the comment
-
NOTE: This method will return the instance for the parent comment.
This means that commentid
will refer to the parent comment, and parentid
refers to its parent respectively.
- On fail, you will get a generic DiFi error.
REMOVED
Grabs the artist comment for a deviation
-
deviation_id
: number
REMOVED
Grabs thread
-
typeid
: number -
item_id
: number (item id of thread you want) -
unknown
: number
Posts a reply to a comment that appeared in the MessageCenter (i.e. Notifications).
The method can be used to remove the comment from message center if the reply is posted to it.
Also see Comments::post
method.
- When replying to a comment that appeared in the Message Center.
-
comment
: string (e.g. "Hey, what's up? :P") -
itemid
: number, id of the object you're replying on (e.g. "503742212") -
parentid
: number, id of the parent comment you're replying to -
typeid
: number, the resource type of the object you're replying on, see Resource Types -
ownerid
: number, e.g. 0 -
remove_message_after_reply
: number,
if ture removes the corresponding message from message center after the reply to the parent comment is posted.
(1 if checked, 0 if not checked)
See Comments::post
method.
Returns comments on an object. Very useful!
Unknown at this moment
-
itemid
: id -
typeid
: id -
offset
: int (e.g. 0) -
limit
: int (e.g. 20)
- On success:
-
thread
: contains array of objects
Refer togetParent
method for example of a comment object -
threadinfo
: object-
hide
: number, ???, e.g. 4 -
master
: boolean, ???, e.g. false -
offset
: number, ???, e.g. 0 -
maxlevel
: number, ???, e.g. 7 -
typeid
: number, the resource type id -
order
: number, ???, e.g. 2 -
limit
: number, equal to thecount_per_page
parameter -
itemid
: number -
limitgood
: number, ??? same aslimit
? -
usericonurl
: boolean, ???, true -
splitid
: purpose unknown -
length
: number, number of all comments on the thread? -
moreleft
: boolean, means if more comments on the next page are available -
lessleft
: boolean, means if more comments on the previous page are available -
next_offset
: -
prev_offset
: -
thread_flat
: object, contains a list of all comments on the thread, with comment ids as keys and the reply counts as each value.
-
-
Edits and already posted comment
- When editing a comment
-
TextToSave
: string (e.g. "Hey, what's up? :P") -
itemid
: number -
parentid
: number or 0 -
typeid
: number
undocumented
undocumented, almost definitely for posts on films, especially when commenting while the film is playing
-
TextToSave
: string (e.g. "Hey, what's up? :P") -
itemid
: number -
parentid
: number or 0 -
typeid
: number -
ownerid
: number or 0 -
time_index
: number or 0
REMOVED
Returns body of a comment in the edit field?
- When trying to edit a comment
-
itemid
: int -
commentid
: int -
typeid
: int
On success, returns string.
Returns the html required to build the top comments on any object?
TODO: What exactly is limited?
-
typeid
: number (e.g. 1 forCOMMENT_DEVIATION
) -
itemid
: number - ???: number (e.g. 0)
-
offset
: int (e.g. 0) -
limit
: int (limit+1 so we can see if there are more to fetch)
Returns a Dialog object, with html
containing complete html for the selected range.
Seems to return form with how to display the comments (Nested/Threaded/Flat, Oldest First/Newest First).
-
comment_typeid
: int -
deviationid
: int -
time_index_beg
: int -
time_index_end
: int -
offset
: int