GrusersModules - danopia/deviantart-difi GitHub Wiki
This class is used to edit various aspects of a profile page (e.g. widgets) and to show information on it.
- Most calls inside the GrusersModules require
POST
method. - The
userid
can be fetched by parsing the page's html content- using code-injection:
var id = deviantART.deviant.id
- using userscript's unsafeWindow:
var id = unsafeWindow.deviantART.deviant.id
- parsing html by matching:
if (!window.deviantART) deviantART = {}; deviantART.deviant = {"loggedIn":true,"browseShadows":true,"username":"Dediggefedde","symbol":"=","usericon":35,"id":3396247,"
- parsing the userprofile's html and looking for the
.devwatch
element, which hasdata-userid="37591934"
attached to it
- using code-injection:
- The
pageid
has to be fetched on the page that is targeted (in this case mostly profile pages).
This works similar to theuserid
, however as it is a key (and not a value), the first two lines look more like:var pageid = 0; for (pageid in deviantART.pageData.user_page_permissions) break;
- The term "Grusers Modules" and "Profile Widgets" are used interchangeably as they refer to the same thing.
- Further information can be acquired by studying the
v6gruser.js
file.
Commits the modules, saving the changes for future visitors.
- Called when closing the modules modal dialog.
-
userid
: number (e.g. "160230") -
pageid
: number (e.g. "324391") -
moduleid
: number (e.g. "344422741")
Returns null
on success.
Fetches the HTML to display a module.
This call returns the required HTML markup to display a profile page module. Sometimes, it solely shows the information displayed in a widget. Other times, it shows the markup displaying the form in order to edit the module content.
This method is also used for pagination on other user pages (e.g. for browsing the llama badge activity).
- Used when a module is loaded after the page, e.g. when a module is shown when expanded from a menubar item.
- Used to generate an HTML preview in some cases (e.g. Cakes Badge page, Group Admin Staff page, Forum page, etc)
- Used to navigate to other pages of a module (e.g. list of announcements, badge activity, etc)
- Used to return the current module content when clicking on "Edit this Widget" and/or "Edit Page" button on top of your profile page
-
pageid
oruserid
: number (e.g. "16020530") -
moduleid
: number (e.g. "324398324") -
target
(?): string (e.g. "index", "stats_pageviews", "view_log", "config_bar", "config" or "generic") -
arguments
: object (e.g.{offset: "10"}
,"topics_offset":"15"}
,{"badgeid":"4588722"}
,{"action":"preview","topic_text":"rere"}
or[]
)
The moduleid
is a number that identifies which module is being manipulated. It usually appears in the class property of the div
tag as modframe-<number>
, with the number being the ID used. Other times, like when calling this with method the stats_pageviews
argument, it will be the ID of the user whose information is being pulled up.
The target
is the property which is being manipulated. The currently known values for this are as follows:
name | description |
---|---|
config |
the markup for configuring a module |
generic |
used to do generic functions like change the offset of what information a module is displaying or simply refresh it |
stats_pageviews |
the markup showing the stats and pageviews of a person in the "Statistics" drop-down menu |
Returns a Dialog object with the additional fields "frame_behavior" and "has_errors".
{"html":" . . . ",
"frame_behavior":
{"log":true,
"delete":true,
"edit":true,
"edit_view":"config"},
"has_errors":false,
"css":"",
"dwaitcalls":[],
"pageData":[],
"deps":[],
"title":null}
NOTE: "delete":true
is only present if it is true.
This is called to retrieve a list of profile widgets when editing a user's profile page or a group's page.
-
owner_id
: number -
module_id
: number
Returns an array of possible modules as object.
Example:
{
"typeid": "4",
"name": "featured_deviation",
"title": "Featured Deviation",
"status": null,
"resource_typeid": 29,
"limit": 10,
"pagename": null,
"allowed_zones": ["top_left"],
"is_destroyable": false,
"zone": null,
"position": null,
"description": "Display your best deviations",
"icon": 5,
"icon_image": null,
"preview_image": null,
"owner_name": "gallery",
"tags": ["General"],
"removable": true,
"count": 0
},
This method is often used with features such as:
- Submit art to group
- Sending group invitation to users
- Asking a group to join
- Leaving a group
-
userid
: number (e.g. 16020530, 27200967) -
page_name
: string (e.g. "hidden", "frontroom", "backroom") -
module_name
: string (e.g. "submit_to_groups", "joinrequest", "recruitment") -
view_name
: string (e.g. "generic", "leave") -
options
: object ({"deviationid":209522027}
) or empty array/object
Returns a Dialog that can be displayed to the user.
Saves a module config.
- Called when exiting a module's settings screen.
-
ownerid
: number (e.g. "160205") -
pageid
: number (e.g. "16020530") -
moduleid
(?): number (e.g. "344422741") -
zone
: string (e.g. "top_left", list in Response section) -
position
: number, post-move -
version
(?): number, pre-move
Returns an object describing the complete page layout, in order to refresh the UI. Example:
{"layout":
{"top_bar": [{"moduleid":324398324,"position":1,"version":1}],
"top_left": [{"moduleid":324398325,"position":2,"version":2},
{"moduleid":324398326,"position":3,"version":2}],
"top_right":[{"moduleid":324398327,"position":1,"version":1},
{"moduleid":324398329,"position":2,"version":1},
{"moduleid":324398328,"position":3,"version":1}],
"mid_left": [{"moduleid":324398330,"position":1,"version":1}],
"ad_zone": [{"moduleid":324398331,"position":1,"version":1}],
"bottom_right":
[{"moduleid":324398332,"position":1,"version":1}]}}
This method saves options you change when editing a profile page module (i.e. widget).
- Called when exiting a module's settings screen.
- Called when saving edits to a profile module (e.g. Donate module, Custom Box, etc)
- Called when posting results to a module (e.g. submitting art to a group)
-
userid
: number (e.g. "160530") -
gallery_id
: number (e.g. "322741") – is the ID to identify what widget is being edited. -
target_view
: string (e.g. "config_bar", "bpp_config", "note_preview", "button", "submit", "config" or "generic") -
config
: object e.g.:{"version":"0","featured_id":"190632014","display_mode":"0","customtext":""}
{"deviationid":"746790210","groupname":"Photo-graphers","is_gallery":"1","first_option":"on","groupname-search":"","folderid":"25025659"}
{"tab":"why_bar","version":"49","validate_token":"2cd9f44a12c40413589c","validate_key":"1477554338","tagline":"super interesting tagline","really_realname":"this is my real name","gender":"m","gender_display":"1","dob_public_display":"1","countryid":"81"}
{"version":"6","returnview":"index","topicid":"0","subject":"This is the text in title!","topic_text":"foo bar","icon":"0","header":"","css":"","footer":""}
{"badgeid":"13043542","note_title":"This is a title","note_body":"This is a body"}
{"roleid":"2351847","message_text":""}
{"set":"55859330"}
Returns a Dialog like displayModule
, except with "view":"generic"
instead of "has_errors":false
.
undocumented
-
module_id
: number -
page_id
: number -
module_name
: string -
zone
: string (e.g. "mid_left") -
position
integer (e.g. 1) -
viewname
: string (e.g. "generic") - unknown (?): bool (e.g. true)
- Used to display the little left bar in your message center with your groups icons.
-
module_id
: number -
page_id
: number -
module_name
: string
- On success, returns a Dialog object that contains the HTML which is displayed for the groups in your Message Center.
// var DiFi=unsafeWindow.DiFi; // needed for userscripts
DiFi.pushPost("GrusersModules","addPreviewModule",["3396247","6010785","group_list"],function(success, data){
console.log(data.response.content.html); // contains the response HTML
});
DiFi.send();
- Called when removing a profile widget from the profile.
-
ownerid
: string (e.g. "27200967") -
pageid
: string (e.g. "16020530") -
widgetid
: string (e.g. "1005752640")
Always returns null. Check for success with the response's status
field.
undocumented
-
userid
: number
undocumented
-
group_id
: number -
layout_type
: string (e.g. 'group.' + the page_name)
undocumented
-
group_id
: number -
page_name
: string -
layout_to_changes_value
: string
undocumented
-
group_id
: number -
page_id
: number
undocumented
-
group_id
: number -
page_name
: string -
position
: number
- When clicking on "Cancel" when previewing a module on "Edit Page".
- Called when adding a new profile widget
-
ownerid
: number (e.g. "27200967") -
pageid
: number (e.g. "16020530") -
widget_name
: string (e.g. "watchers") -
zone
: string (e.g. "mid_left", list in Response section) -
position
: number (e.g. "13")
undocumented
undocumented
typeid |
name |
title |
description |
---|---|---|---|
1 | info |
Group Info | Share information about the Group |
3 | members |
Admins | Display your Group's admins |
4 | featured_deviation |
Featured Deviation | Display your best deviations |
7 | watchers |
Watchers | Display deviants who watch you |
12 | faves |
Favourites | Share art you like |
13 | newest |
Newest Deviations | Share your latest deviations |
15 | polls |
Polls | Ask a question to members and visitors |
17 | visitors |
Visitors | Display who's visited your profile |
23 | journal |
Journal | Display your latest journal entry |
25 | customtext |
Custom | Display custom text and art |
27 | friends |
Friends | Showcase deviants you are friends with |
30 | wishlist |
Wishlist | Display items from your wishlist |
34 | recent_journals |
Journal History | Display a list of recent Journal entries |
35 | twitter |
Display your latest tweets | |
38 | shoutbox |
Shoutbox | A chatroom for your profile |
39 | forum |
Forum | A forum on your Profile |
48 | gallery_folders |
Gallery Folder | Highlight a specific folder in your Gallery |
49 | collections |
Collection | Share art from a Collection |
59 | critique |
Critiques | Share Critiques you've left on others' deviations |
65 | recruitment |
Send Invitation | Recruit members |
69 | social |
Deviant Display | Display Group members, watchers, and recent visitors |
74 | countdown |
Countdown | Set a countdown for Group events |
76 | group_welcome |
Welcome to the Group | Welcome Group admins to the backroom |
80 | aggregation_list |
Gallery List | Show a list of the Group's Gallery folders |
81 | collections_list |
Collection List | Show a list of the Group's Collections |
88 | shop_prints |
Prints | Showcase the Prints you have for sale |
89 | featured_prints |
Featured Print | Feature one of your Prints |
90 | ijustsold_prints |
I Just Sold... | Showcase your most recently sold Print |
97 | groupstats_monthly |
Monthly Stats | Display the Group's activity statistics for the past month |
106 | featured_bulletin |
Announcement | Feature a single announcement |
107 | recent_bulletins |
Recent Announcements | List recently posted announcements |
109 | skin_manager |
Skin Manager | Edit installed DeviantArt skins and create custom skins |
110 | activity |
Visitors | Display who has recently visited the Group |
114 | groupstats_weekly |
Weekly Stats | Display the Group's activity statistics for the past week |
117 | active_members |
Active Members | Show Group members who have been most active |
118 | newest_members |
Newest Members | Feature your Group's newest members |
119 | group_list |
Groups | Display your Groups |
122 | recent_notes |
Recent Notes | Recently received Group Notes |
123 | faves_contributors |
Latest Favourite Artists | Feature artists whose work frequents the Group's Favourites |
134 | affiliates |
Affiliates | Feature your Group's affiliates |
143 | donations |
Donate Points | Request donations for a cause |
147 | aboutme |
deviantID | Introduce yourself! |
153 | commissions |
Commissions | Make money with custom art Commissions |
154 | feed |
Activity | A feed of your recent activity |
157 | pride |
Pride | Show your pride! |