DrawPlz - danopia/deviantart-difi GitHub Wiki

This object deals with anything Muro-related.

get_buy_modal

Returns the Dialog to buy brushsets for you/others.

Usage

  • Used when buying brushsets for others/self.

Params

  • brushpack: number (i.e. 2 for dragon pack, 3 for bottlebrush pack)
  • deviantid: number, Deviant you want to buy brushesets for

Response

Returns a typical modal dialog, with HTML and CSS.

get_brushes

Returns a brushset for Muro. Also returns a list of brushsets for sale if you are willing to scrap them from JS.

Usage

  • When loading an inline Muro (possibly full Muro too?)

Params

  • brushset: number (i.e. 0 for default)

Response

Returns the brushset as DWaitCalls in a Dialog. For example:

{"html":"",
 "css":"",
 "dwaitcalls":[
   [["jms\/pages\/drawplz\/gBrushList.js",
     "jms\/pages\/drawplz\/brushes\/webink.js",
     "jms\/pages\/drawplz\/brushes\/basic.js",
     . . .
     "jms\/pages\/drawplz\/brushes\/yarn.js"],
   "   window.gBrushList.addBrush(WebinkBrush); . . . brushes:['Splatter','Heat','Concrete','Rough']}    ];\n"]],
 "pageData":[],
 "deps":[
   ["v6core_jc.js","http:\/\/st.deviantart.net\/css\/v6core_jc.js",113139965228,null],
   ["canvas_draw_pre_jc.js","http:\/\/st.deviantart.net\/css\/canvas_draw_pre_jc.js",20758573623,null],
   ["canvas_jc.js","http:\/\/st.deviantart.net\/css\/canvas_jc.js",3900769378,null],
   ["newbean_jc.js","http:\/\/st.deviantart.net\/css\/newbean_jc.js",3012370353,null],
   ["drawplz_brushes_jc.js","http:\/\/st.deviantart.net\/css\/drawplz_brushes_jc.js",61771183451,null]],
 "title":null}

get_drafts_list

Returns a JSON object listing saved Muro drafts.

Usage

  • When loading a draft in Muro.

Params

  • offset: number (starts at 0)
  • limit: number (defaults to 4)

Response

Return basic information on saved drafts. Example:

{"offset":0,
 "limit":4,
 "total":"1",
 "isPremiumMember":null,
 "drafts":[
  {"fileid":"68064",
   "title":"Test",
   "modifiedts":"12:42pm, 25 December 2010",
   "layercount":"2",
   "width":"1326",
   "height":"417",
   "thumb":"http:\/\/fc03.deviantart.net\/fs71\/z\/2010\/359\/draft_thumb-c86b8bef27466c6a7456f265f4ca626c.png",
   "is_collab":0,
   "disabled":false}]}

inline_html

Returns the HTML for an inline Muro instance.

Usage

  • When loading Muro in a comment.

Params

None.

Response

Returns a simple Dialog with only htmlContent (and a long one).

load_draft

Returns more detailed information a saved draft, and includes a link to the draft's JSON save-file.

Usage

  • When loading a saved draft.

Params

  • fileid: number

Response

Returns a single object. Example:

{"draftid":"68064",
 "ownerid":"16020530",
 "title":"Test",
 "url":"http:\/\/fc05.deviantart.net\/fs70\/z\/json\/2010\/359\/b\/b\/68064-bb54714de5f7fed910865a974aa18ea8.json",
 "formatversion":"2",
 "version":"1",
 "width":"1326",
 "height":"417",
 "is_collab":0,
 "is_public":0,
 "is_guest":false}

load_user_settings

Returns the user's muro settings.

Usage

  • When loading Muro.

Params

None.

Response

For me it returns:

{"settings":false}

Might change if I change some settings (TODO)

save_draft

Uploads a draft to Muro's online storage.

Usage

  • When uploading a draft.

Params

  • ???: number (0)
  • title: string
  • width: number
  • height: number
  • layers: number (2) (or version)
  • version: number (2) (or version)
  • data: string, raw JSON which describes the document, including Base64-encoded PNGs of the layers.
  • fileid: number, ID of the drawing you're replacing. (TODO: 0 for a new one?)

Example data (with trimmed PNGs):

"{\"version\": 0,\"title\": \"Tablet test\",\"dimension\": {\"width\": 1326,\"height\": 417},\"layers\": 
 [{\"name\": \"Background\",\"opacity\": \"1\",\"order\": \"0\",\"visible\": true,\"data\": 
 \"data:image\/png;base64,iVBORw0KGgoAAAANSUhETkJggg==\"},{\"name\": \"Layer 1\",\"opacity\": 
 \"1\",\"order\": \"1\",\"visible\": true,\"data\": \"data:image\/png;base64,iVBORw0KGgoAAAANSUhE5CYII="

Response

Returns a single object with some basic infoz on the new file. For some reason, the new JSON download is linked to, even though you just uploaded it.

The object has draftid, url, title, version, and layer_data (which was nil?).

login_noop

undocumented

Params

None